Skip to content

Commit 1c6fd6d

Browse files
committed
Tests: update PHPStanTypeNodeResolverTest - save original PHPStan source to simplify diff with changes, rename to PHPStanTypeNodeResolverSourceCodeChangesTest
1 parent 95a6010 commit 1c6fd6d

3 files changed

Lines changed: 1011 additions & 4 deletions

File tree

phpcs-ignores.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ ignoreErrors:
9393
sniff: PSR1.Files.SideEffects.FoundWithSymbols
9494
message: 'A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 10 and the first side effect is on line 8.'
9595
count: 1
96-
path: tests/PHPStanTypeNodeResolverTest.php
96+
path: tests/PHPStanTypeNodeResolverSourceCodeChangesTest.php
9797

9898
-
9999
sniff: PSR1.Files.SideEffects.FoundWithSymbols

tests/PHPStanTypeNodeResolverTest.php renamed to tests/PHPStanTypeNodeResolverSourceCodeChangesTest.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77

88
require __DIR__ . '/bootstrap.php';
99

10-
class PHPStanTypeNodeResolverTest
10+
class PHPStanTypeNodeResolverSourceCodeChangesTest
1111
{
1212
private const string EXPECTED_HASH_MD5 = 'dca050c2713b7682a7e471a611da7cef';
1313

14+
private const string PHP_SOURCE_FOR_DIFF = __DIR__ . '/assets/phpstan-src/PHPStan_PhpDoc_TypeNodeResolver.phps';
15+
1416

1517
public static function test(): void
1618
{
@@ -24,14 +26,22 @@ public static function test(): void
2426

2527
$actualHash = md5($source);
2628

29+
file_put_contents(__DIR__ . '/assets/phpstan-src/PHPStan_PhpDoc_TypeNodeResolver.phps', $source);
30+
2731
assert(
2832
$actualHash === self::EXPECTED_HASH_MD5,
29-
sprintf('Class %s was changed, expected hash is \'%s\' != actual hash \'%s\' check differences and update hash.', TypeNodeResolver::class, self::EXPECTED_HASH_MD5, $actualHash),
33+
sprintf(
34+
'Class %s was changed, expected hash is \'%s\' != actual hash \'%s\' check differences in \'%s\' and update hash.',
35+
TypeNodeResolver::class,
36+
self::EXPECTED_HASH_MD5,
37+
$actualHash,
38+
self::PHP_SOURCE_FOR_DIFF,
39+
),
3040
);
3141
}
3242

3343
}
3444

3545
Assert::noError(static function (): void {
36-
PHPStanTypeNodeResolverTest::test();
46+
PHPStanTypeNodeResolverSourceCodeChangesTest::test();
3747
});

0 commit comments

Comments
 (0)