ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Composer\Test\InstallerTest Class Reference

Tests registering Component Installer with Composer. More...

+ Inheritance diagram for Composer\Test\InstallerTest:
+ Collaboration diagram for Composer\Test\InstallerTest:

Public Member Functions

 testInstallerCreationShouldNotCreateComponentDirectory ()
 Tests that the Installer doesn't create the Component directory. More...
 
 testComponentSupports ($type, $expected)
 Test the Installer's support() function. More...
 
 providerComponentSupports ()
 Data provider for testComponentSupports(). More...
 
 testGetComponentPath ($expected, $package)
 Tests the Installer's getComponentPath function. More...
 
 providerGetComponentPath ()
 Data provider for testGetComponentPath(). More...
 

Protected Member Functions

 setUp ()
 {} More...
 
 tearDown ()
 {} More...
 

Protected Attributes

 $componentDir = 'components'
 
 $config
 
 $fs
 

Detailed Description

Tests registering Component Installer with Composer.

Definition at line 23 of file InstallerTest.php.

Member Function Documentation

◆ providerComponentSupports()

Composer\Test\InstallerTest::providerComponentSupports ( )

Data provider for testComponentSupports().

See also
testComponentSupports()

Definition at line 100 of file InstallerTest.php.

References array.

101  {
102  // All package types support having Components.
103  $tests[] = array('component', true);
104  $tests[] = array('all-supported', false);
105 
106  return $tests;
107  }
Create styles array
The data for the language used.

◆ providerGetComponentPath()

Composer\Test\InstallerTest::providerGetComponentPath ( )

Data provider for testGetComponentPath().

See also
testGetComponentPath()

Definition at line 136 of file InstallerTest.php.

References array.

137  {
138  $package = array(
139  'name' => 'foo/bar',
140  'type' => 'component',
141  'version' => '1.0.0',
142  );
143  $tests[] = array('bar', $package);
144 
145  $package = array(
146  'name' => 'foo/bar2',
147  'version' => '1.0.0',
148  'type' => 'component',
149  'extra' => array(
150  'component' => array(
151  'name' => 'foo',
152  ),
153  ),
154  );
155  $tests[] = array('foo', $package);
156 
157  return $tests;
158  }
Create styles array
The data for the language used.

◆ setUp()

Composer\Test\InstallerTest::setUp ( )
protected

{}

Definition at line 40 of file InstallerTest.php.

References array.

41  {
42  // Run through the Library Installer Test set up.
43  parent::setUp();
44 
45  // Also be sure to set up the Component directory.
46  $this->componentDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'composer-test-component';
47  $this->ensureDirectoryExistsAndClear($this->componentDir);
48 
49  // Merge the component-dir setting in so that it applies correctly.
50  $this->config->merge(array(
51  'config' => array(
52  'component-dir' => $this->componentDir,
53  ),
54  ));
55  }
Create styles array
The data for the language used.

◆ tearDown()

Composer\Test\InstallerTest::tearDown ( )
protected

{}

Definition at line 60 of file InstallerTest.php.

61  {
62  $this->fs->removeDirectory($this->componentDir);
63 
64  parent::tearDown();
65  }

◆ testComponentSupports()

Composer\Test\InstallerTest::testComponentSupports (   $type,
  $expected 
)

Test the Installer's support() function.

Parameters
$typeThe type of library.
$expectedWhether or not the given type is supported by Component Installer.
Returns
void

providerComponentSupports

Definition at line 89 of file InstallerTest.php.

90  {
91  $installer = new Installer($this->io, $this->composer, 'component');
92  $this->assertSame($expected, $installer->supports($type), sprintf('Failed to show support for %s', $type));
93  }

◆ testGetComponentPath()

Composer\Test\InstallerTest::testGetComponentPath (   $expected,
  $package 
)

Tests the Installer's getComponentPath function.

Parameters
$expectedThe expected install path for the package.
$packageThe package to test upon.

providerGetComponentPath

See also
::getComponentPath()

Definition at line 121 of file InstallerTest.php.

References $loader, and $result.

121  {
122  // Construct the mock objects.
123  $installer = new Installer($this->io, $this->composer, 'component');
124  $loader = new ArrayLoader();
125 
126  // Test the results.
127  $result = $installer->getComponentPath($loader->load($package));
128  $this->assertEquals($this->componentDir . DIRECTORY_SEPARATOR . $expected, $result);
129  }
$result

◆ testInstallerCreationShouldNotCreateComponentDirectory()

Composer\Test\InstallerTest::testInstallerCreationShouldNotCreateComponentDirectory ( )

Tests that the Installer doesn't create the Component directory.

Definition at line 70 of file InstallerTest.php.

71  {
72  $this->fs->removeDirectory($this->componentDir);
73  new Installer($this->io, $this->composer);
74  $this->assertFileNotExists($this->componentDir);
75  }

Field Documentation

◆ $componentDir

Composer\Test\InstallerTest::$componentDir = 'components'
protected

Definition at line 25 of file InstallerTest.php.

◆ $config

Composer\Test\InstallerTest::$config
protected

Definition at line 30 of file InstallerTest.php.

◆ $fs

Composer\Test\InstallerTest::$fs
protected

Definition at line 35 of file InstallerTest.php.


The documentation for this class was generated from the following file: