Skip to content

Commit ca06707

Browse files
committed
ProcessRulesetAutoloadTest: add some additional path variation tests
1 parent d473ebd commit ca06707

6 files changed

+69
-8
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
/**
3+
* Test fixture.
4+
*
5+
* This file is only used to check whether it has been `include`d.
6+
*
7+
* @see \PHP_CodeSniffer\Tests\Core\Ruleset\ProcessRulesetAutoloadTest
8+
*/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
/**
3+
* Test fixture.
4+
*
5+
* This file is only used to check whether it has been `include`d.
6+
*
7+
* @see \PHP_CodeSniffer\Tests\Core\Ruleset\ProcessRulesetAutoloadTest
8+
*/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
/**
3+
* Test fixture.
4+
*
5+
* This file is only used to check whether it has been `include`d.
6+
*
7+
* @see \PHP_CodeSniffer\Tests\Core\Ruleset\ProcessRulesetAutoloadTest
8+
*/

tests/Core/Ruleset/ProcessRulesetAutoloadTest.php

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,24 @@ public function testShouldProcessAutoloadCsonly()
5252
$diff = array_diff($finalIncludes, $originallyIncludes);
5353

5454
$this->assertContains(
55-
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadAlways.php'),
55+
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadAlways.1.php'),
5656
$diff,
57-
'ProcessRulesetAutoloadLoadAlways.php autoload file was not loaded'
57+
'ProcessRulesetAutoloadLoadAlways.1.php autoload file was not loaded'
58+
);
59+
$this->assertContains(
60+
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadAlways.2.php'),
61+
$diff,
62+
'ProcessRulesetAutoloadLoadAlways.2.php autoload file was not loaded'
63+
);
64+
$this->assertContains(
65+
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadAlways.3.php'),
66+
$diff,
67+
'ProcessRulesetAutoloadLoadAlways.3.php autoload file was not loaded'
68+
);
69+
$this->assertContains(
70+
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadAlways.4.php'),
71+
$diff,
72+
'ProcessRulesetAutoloadLoadAlways.4.php autoload file was not loaded'
5873
);
5974
$this->assertContains(
6075
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadPhpcsOnly.php'),
@@ -95,9 +110,24 @@ public function testShouldProcessAutoloadCbfonly()
95110
$diff = array_diff($finalIncludes, $originallyIncludes);
96111

97112
$this->assertContains(
98-
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadAlways.php'),
113+
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadAlways.1.php'),
114+
$diff,
115+
'ProcessRulesetAutoloadLoadAlways.1.php autoload file was not loaded'
116+
);
117+
$this->assertContains(
118+
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadAlways.2.php'),
119+
$diff,
120+
'ProcessRulesetAutoloadLoadAlways.2.php autoload file was not loaded'
121+
);
122+
$this->assertContains(
123+
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadAlways.3.php'),
124+
$diff,
125+
'ProcessRulesetAutoloadLoadAlways.3.php autoload file was not loaded'
126+
);
127+
$this->assertContains(
128+
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadAlways.4.php'),
99129
$diff,
100-
'ProcessRulesetAutoloadLoadAlways.php autoload file was not loaded'
130+
'ProcessRulesetAutoloadLoadAlways.4.php autoload file was not loaded'
101131
);
102132
$this->assertNotContains(
103133
__DIR__.str_replace('/', DIRECTORY_SEPARATOR, '/Fixtures/ProcessRulesetAutoloadLoadPhpcsOnly.php'),

tests/Core/Ruleset/ProcessRulesetAutoloadTest.xml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@
44
<file>.</file>
55

66
<!--
7-
################
8-
# Neither set. #
9-
################
7+
###############################################
8+
# Neither set. #
9+
# Testing various ways paths can be provided. #
10+
###############################################
1011
-->
11-
<autoload>./tests/Core/Ruleset/Fixtures/ProcessRulesetAutoloadLoadAlways.php</autoload>
12+
<!-- Path relative to directory containing the ruleset. -->
13+
<autoload>./Fixtures/ProcessRulesetAutoloadLoadAlways.1.php</autoload>
14+
<autoload>Fixtures/ProcessRulesetAutoloadLoadAlways.2.php</autoload>
15+
16+
<!-- Path relative to command directory. -->
17+
<autoload>./tests/Core/Ruleset/Fixtures/ProcessRulesetAutoloadLoadAlways.3.php</autoload>
18+
<autoload>tests/Core/Ruleset/Fixtures/ProcessRulesetAutoloadLoadAlways.4.php</autoload>
1219

1320
<!--
1421
###################

0 commit comments

Comments
 (0)