|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SilverStripe\Core\Tests\Manifest; |
|
4
|
|
|
|
|
5
|
|
|
use SilverStripe\Control\Director; |
|
6
|
|
|
use SilverStripe\Core\Manifest\Module; |
|
7
|
|
|
use SilverStripe\Dev\SapphireTest; |
|
8
|
|
|
|
|
9
|
|
|
class ModuleTest extends SapphireTest |
|
10
|
|
|
{ |
|
11
|
|
|
public function testUnsetResourcesDir() |
|
12
|
|
|
{ |
|
13
|
|
|
$path = __DIR__ . '/fixtures/ss-projects/withoutCustomResourcesDir'; |
|
14
|
|
|
$module = new Module($path, $path); |
|
15
|
|
|
$this->assertEquals('', $module->getResourcesDir()); |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
public function testResourcesDir() |
|
19
|
|
|
{ |
|
20
|
|
|
$path = __DIR__ . '/fixtures/ss-projects/withCustomResourcesDir'; |
|
21
|
|
|
$module = new Module($path, $path); |
|
22
|
|
|
$this->assertEquals('customised-resources-dir', $module->getResourcesDir()); |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @dataProvider ciConfigProvider |
|
27
|
|
|
* @param string $fixture The folder containing our test composer file |
|
28
|
|
|
* @param string $expectedPhpConfig |
|
29
|
|
|
*/ |
|
30
|
|
|
public function testGetCIConfig($fixture, $expectedPhpConfig) |
|
31
|
|
|
{ |
|
32
|
|
|
$path = __DIR__ . '/fixtures/phpunit-detection/' . $fixture; |
|
33
|
|
|
$module = new Module($path, $path); |
|
34
|
|
|
$this->assertEquals( |
|
35
|
|
|
$expectedPhpConfig, |
|
36
|
|
|
$module->getCIConfig()['PHP'], |
|
37
|
|
|
'PHP config is set to ' . $expectedPhpConfig |
|
38
|
|
|
); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function ciConfigProvider() |
|
42
|
|
|
{ |
|
43
|
|
|
return [ |
|
44
|
|
|
'empty require-dev' => ['empty-require-dev', Module::CI_UNKNOWN], |
|
45
|
|
|
'no require-dev' => ['no-require-dev', Module::CI_UNKNOWN], |
|
46
|
|
|
'older version of phpunit' => ['old-phpunit', Module::CI_UNKNOWN], |
|
47
|
|
|
'phpunit between 5 and 9' => ['inbetween-phpunit', Module::CI_UNKNOWN], |
|
48
|
|
|
'phpunit beyond 9' => ['future-phpunit', Module::CI_UNKNOWN], |
|
49
|
|
|
|
|
50
|
|
|
'phpunit 5.0' => ['phpunit-five-zero', Module::CI_PHPUNIT_FIVE], |
|
51
|
|
|
'phpunit 5.7' => ['phpunit-five-seven', Module::CI_PHPUNIT_FIVE], |
|
52
|
|
|
'phpunit 5 exact version' => ['phpunit-five-exact-version', Module::CI_PHPUNIT_FIVE], |
|
53
|
|
|
'phpunit 5 tilde' => ['phpunit-five-tilde', Module::CI_PHPUNIT_FIVE], |
|
54
|
|
|
'sminnee 5.7' => ['sminnee-five-seven', Module::CI_PHPUNIT_FIVE], |
|
55
|
|
|
'sminnee 5' => ['sminnee-five-seven', Module::CI_PHPUNIT_FIVE], |
|
56
|
|
|
'sminnee 5 star' => ['sminnee-five-star', Module::CI_PHPUNIT_FIVE], |
|
57
|
|
|
|
|
58
|
|
|
'phpunit 9' => ['phpunit-nine', Module::CI_PHPUNIT_NINE], |
|
59
|
|
|
'phpunit 9.5' => ['phpunit-nine-five', Module::CI_PHPUNIT_NINE], |
|
60
|
|
|
'future phpunit 9' => ['phpunit-nine-x', Module::CI_PHPUNIT_NINE], |
|
61
|
|
|
'phpunit 9 exact version' => ['phpunit-nine-exact', Module::CI_PHPUNIT_NINE], |
|
62
|
|
|
|
|
63
|
|
|
'recipe-testing 1' => ['recipe-testing-one', Module::CI_PHPUNIT_FIVE], |
|
64
|
|
|
'recipe-testing 1.x' => ['recipe-testing-one-x', Module::CI_PHPUNIT_FIVE], |
|
65
|
|
|
'recipe-testing 1.2.x' => ['recipe-testing-one-two-x', Module::CI_PHPUNIT_FIVE], |
|
66
|
|
|
'recipe-testing 1 with stability flag' => ['recipe-testing-one-flag', Module::CI_PHPUNIT_FIVE], |
|
67
|
|
|
|
|
68
|
|
|
'recipe-testing 2' => ['recipe-testing-two', Module::CI_PHPUNIT_NINE], |
|
69
|
|
|
'recipe-testing 2.x' => ['recipe-testing-two-x', Module::CI_PHPUNIT_NINE], |
|
70
|
|
|
'recipe-testing 2 exact' => ['recipe-testing-two-x', Module::CI_PHPUNIT_NINE], |
|
71
|
|
|
]; |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|