Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0acb40e

Browse files
refactor: Restructure test fixtures (#15)
1 parent dd65314 commit 0acb40e

25 files changed

+21
-23
lines changed

‎composer.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
}
4747
},
4848
"autoload-dev": {
49-
"psr-4": {
50-
"CodeIgniter\\PHPStan\\Tests\\": "tests/"
51-
}
49+
"classmap": [
50+
"tests/"
51+
]
5252
},
5353
"config": {
5454
"allow-plugins": {

‎phpstan.neon.dist‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ parameters:
1212
analyseAndScan:
1313
- src/ComposerJsonRewriter.php
1414
- src/ComposerScripts.php
15-
- tests/Fixtures
15+
- tests/*/data/*
1616
tmpDir: build/phpstan
1717
bootstrapFiles:
1818
- vendor/codeigniter4/framework/system/Test/bootstrap.php
19-
scanDirectories:
20-
- vendor/codeigniter4/framework/system/Helpers
2119
codeigniter:
2220
additionalModelNamespaces:
2321
- CodeIgniter\PHPStan\Tests\Fixtures\Type

‎tests/Rules/Classes/CacheHandlerInstantiationRuleTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function getRule(): Rule
3636

3737
public function testRule(): void
3838
{
39-
$this->analyse([__DIR__ . '/../../Fixtures/Rules/Classes/cache-handler.php'], [
39+
$this->analyse([__DIR__ . '/data/cache-handler.php'], [
4040
[
4141
'Calling new FileHandler() directly is incomplete to get the cache instance.',
4242
19,

‎tests/Rules/Classes/FrameworkExceptionInstantiationRuleTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function getRule(): Rule
3535

3636
public function testRule(): void
3737
{
38-
$this->analyse([__DIR__ . '/../../Fixtures/Rules/Classes/framework-exception.php'], [
38+
$this->analyse([__DIR__ . '/data/framework-exception.php'], [
3939
[
4040
'Instantiating FrameworkException using new is not allowed. Use one of its named constructors instead.',
4141
17,

‎tests/Rules/Functions/FactoriesFunctionArgumentTypeRuleTest.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ protected function getRule(): Rule
5454
public function testRule(): void
5555
{
5656
$this->analyse([
57-
__DIR__ . '/../../Fixtures/Type/config.php',
58-
__DIR__ . '/../../Fixtures/Type/model.php',
57+
__DIR__ . '/../../Type/data/config.php',
58+
__DIR__ . '/../../Type/data/model.php',
5959
], [
6060
[
6161
'Parameter #1 $name of function config expects a valid class string, \'bar\' given.',
@@ -107,6 +107,6 @@ public function testRule(): void
107107
public function testAllowNonModelClassesOnModelCall(): void
108108
{
109109
$this->checkArgumentTypeOfModel = false;
110-
$this->analyse([__DIR__ . '/../../Fixtures/Rules/Functions/bug-8.php'], []);
110+
$this->analyse([__DIR__ . '/data/bug-8.php'], []);
111111
}
112112
}

‎tests/Rules/Functions/NoClassConstFetchOnFactoriesFunctionsTest.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ protected function getRule(): Rule
4141
public function testRule(): void
4242
{
4343
$this->analyse([
44-
__DIR__ . '/../../Fixtures/Type/config.php',
45-
__DIR__ . '/../../Fixtures/Type/factories-in-tests.php',
46-
__DIR__ . '/../../Fixtures/Type/model.php',
44+
__DIR__ . '/../../Type/data/config.php',
45+
__DIR__ . '/../../Type/data/factories-in-tests.php',
46+
__DIR__ . '/../../Type/data/model.php',
4747
], [
4848
[
4949
'Call to function config with CodeIgniter\Shield\Config\AuthJWT::class is discouraged.',
@@ -65,6 +65,6 @@ public function testRule(): void
6565

6666
public function testOnAppNamespaceWithNonAppCall(): void
6767
{
68-
$this->analyse([__DIR__ . '/../../Fixtures/Rules/Functions/bug-9.php'], []);
68+
$this->analyse([__DIR__ . '/data/bug-9.php'], []);
6969
}
7070
}

‎tests/Rules/Functions/ServicesFunctionArgumentTypeRuleTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected function getRule(): Rule
3939

4040
public function testRule(): void
4141
{
42-
$this->analyse([__DIR__ . '/../../Fixtures/Type/services.php'], [
42+
$this->analyse([__DIR__ . '/../../Type/data/services.php'], [
4343
[
4444
'The method \'createRequest\' is reserved for service location internals and cannot be used as a service method.',
4545
51,
File renamed without changes.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /