ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ComponentInstaller\Test\Process\CopyProcessTest Class Reference

Tests CopyProcess. More...

+ Inheritance diagram for ComponentInstaller\Test\Process\CopyProcessTest:
+ Collaboration diagram for ComponentInstaller\Test\Process\CopyProcessTest:

Public Member Functions

 setUp ()
 
 testCopyStyles ($packages, $files)
 testCopy More...
 
 providerCopyStyles ()
 
- Public Member Functions inherited from ComponentInstaller\Test\Process\ProcessTest
 setUp ()
 
 testGetComponentName ($prettyName, array $extra, $expected)
 testGetComponentName More...
 
 providerGetComponentName ()
 Data provider for testGetComponentName. More...
 

Protected Attributes

 $process
 
- Protected Attributes inherited from ComponentInstaller\Test\Process\ProcessTest
 $composer
 
 $config
 
 $io
 
 $filesystem
 
 $componentDir
 
 $vendorDir
 
 $binDir
 
 $installationManager
 

Additional Inherited Members

- Protected Member Functions inherited from ComponentInstaller\Test\Process\ProcessTest
 tearDown ()
 

Detailed Description

Tests CopyProcess.

Definition at line 19 of file CopyProcessTest.php.

Member Function Documentation

◆ providerCopyStyles()

ComponentInstaller\Test\Process\CopyProcessTest::providerCopyStyles ( )

Definition at line 49 of file CopyProcessTest.php.

References array.

50  {
51  // Test collecting one style.
52  $package = array(
53  'name' => 'components/package',
54  'version' => '1.2.3',
55  'is-root' => true, // Set the root so that it knows to use the cwd.
56  'extra' => array(
57  'component' => array(
58  'styles' => array(
59  'tests/ComponentInstaller/Test/Resources/test.css',
60  ),
61  ),
62  ),
63  );
64  $packages = array($package);
65  $tests[] = array($packages, array(
66  'package/tests/ComponentInstaller/Test/Resources/test.css',
67  ));
68 
69  // Test collecting two styles.
70  $package = array(
71  'name' => 'components/packagewithtwostyles',
72  'version' => '1.2.3',
73  'is-root' => true, // Set the root so that it knows to use the cwd.
74  'extra' => array(
75  'component' => array(
76  'styles' => array(
77  'tests/ComponentInstaller/Test/Resources/test.css',
78  'tests/ComponentInstaller/Test/Resources/test2.css',
79  ),
80  ),
81  ),
82  );
83  $packages = array($package);
84  $tests[] = array($packages, array(
85  'packagewithtwostyles/tests/ComponentInstaller/Test/Resources/test.css',
86  'packagewithtwostyles/tests/ComponentInstaller/Test/Resources/test2.css',
87  ));
88 
89  // Test collecting a style that doesn't exist.
90  $package = array(
91  'name' => 'components/stylethatdoesnotexist',
92  'version' => '1.2.3',
93  'is-root' => true, // Set the root so that it knows to use the cwd.
94  'extra' => array(
95  'component' => array(
96  'styles' => array(
97  'tests/ComponentInstaller/Test/Resources/test.css',
98  'tests/ComponentInstaller/Test/Resources/test-not-found.css',
99  ),
100  ),
101  ),
102  );
103  $packages = array($package);
104  $tests[] = array($packages, array(
105  'stylethatdoesnotexist/tests/ComponentInstaller/Test/Resources/test.css',
106  ));
107 
108  // Test collecting all styles, files and scripts.
109  $package = array(
110  'name' => 'components/allassets',
111  'version' => '1.2.3',
112  'is-root' => true, // Set the root so that it knows to use the cwd.
113  'extra' => array(
114  'component' => array(
115  'styles' => array(
116  'tests/ComponentInstaller/Test/Resources/test.css',
117  ),
118  'files' => array(
119  'tests/ComponentInstaller/Test/Resources/img.jpg',
120  'tests/ComponentInstaller/Test/Resources/img2.jpg',
121  ),
122  'scripts' => array(
123  'tests/ComponentInstaller/Test/Resources/test.js'
124  ),
125  ),
126  ),
127  );
128  $packages = array($package);
129  $tests[] = array($packages, array(
130  'allassets/tests/ComponentInstaller/Test/Resources/test.css',
131  'allassets/tests/ComponentInstaller/Test/Resources/img.jpg',
132  'allassets/tests/ComponentInstaller/Test/Resources/img2.jpg',
133  'allassets/tests/ComponentInstaller/Test/Resources/test.js',
134  ));
135 
136  // Test copying a different component name.
137  $package = array(
138  'name' => 'components/differentcomponentname',
139  'version' => '1.2.3',
140  'is-root' => true, // Set the root so that it knows to use the cwd.
141  'extra' => array(
142  'component' => array(
143  'name' => 'diffname',
144  'files' => array(
145  'tests/ComponentInstaller/Test/Resources/img.jpg',
146  ),
147  ),
148  ),
149  );
150  $packages = array($package);
151  $tests[] = array($packages, array(
152  'diffname/tests/ComponentInstaller/Test/Resources/img.jpg',
153  ));
154 
155  // Test two different packages.
156  $package = array(
157  'name' => 'components/twopackages1',
158  'version' => '1.2.3',
159  'is-root' => true, // Set the root so that it knows to use the cwd.
160  'extra' => array(
161  'component' => array(
162  'files' => array(
163  'tests/ComponentInstaller/Test/Resources/img.jpg',
164  ),
165  ),
166  ),
167  );
168  $package2 = array(
169  'name' => 'components/twopackages2',
170  'version' => '1.2.3',
171  'is-root' => true, // Set the root so that it knows to use the cwd.
172  'extra' => array(
173  'component' => array(
174  'name' => 'twopackages2-diff',
175  'files' => array(
176  'tests/ComponentInstaller/Test/Resources/img2.jpg',
177  ),
178  ),
179  ),
180  );
181  $packages = array($package, $package2);
182  $tests[] = array($packages, array(
183  'twopackages1/tests/ComponentInstaller/Test/Resources/img.jpg',
184  'twopackages2-diff/tests/ComponentInstaller/Test/Resources/img2.jpg',
185  ));
186 
187  // Test copying an asset with a glob().
188  $package = array(
189  'name' => 'components/differentcomponentname',
190  'version' => '1.2.3',
191  'is-root' => true, // Set the root so that it knows to use the cwd.
192  'extra' => array(
193  'component' => array(
194  'name' => 'diffname',
195  'files' => array(
196  'tests/ComponentInstaller/Test/Resources/*.jpg',
197  ),
198  ),
199  ),
200  );
201  $packages = array($package);
202  $tests[] = array($packages, array(
203  'diffname/tests/ComponentInstaller/Test/Resources/img.jpg',
204  'diffname/tests/ComponentInstaller/Test/Resources/img2.jpg',
205  ));
206 
207  return $tests;
208  }
Create styles array
The data for the language used.

◆ setUp()

ComponentInstaller\Test\Process\CopyProcessTest::setUp ( )

Definition at line 26 of file CopyProcessTest.php.

27  {
28  parent::setUp();
29  $this->process = new CopyProcess($this->composer, $this->io);
30  }

◆ testCopyStyles()

ComponentInstaller\Test\Process\CopyProcessTest::testCopyStyles (   $packages,
  $files 
)

testCopy

providerCopyStyles

Parameters
array$packages
array$files

Definition at line 39 of file CopyProcessTest.php.

References $file, and $files.

40  {
41  // Initialize the process.
42  $this->process->init();
43  $this->process->copy($packages);
44  foreach ($files as $file) {
45  $this->assertFileExists($this->componentDir.'/' . $file, sprintf('Failed to find the destination file: %s', $file));
46  }
47  }
$files
Definition: add-vimline.php:18
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file

Field Documentation

◆ $process

ComponentInstaller\Test\Process\CopyProcessTest::$process
protected

Definition at line 24 of file CopyProcessTest.php.


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