Skip to content

Commit

Permalink
[BUGFIX] Fix functional tests after phpstan fix
Browse files Browse the repository at this point in the history
Phpstan made aware, that there were some weak spots in the
functional testings and fixtures. After these were solved
the tests needed to get green again.
  • Loading branch information
garbast committed Nov 17, 2024
1 parent d00b8ca commit 8dac7a4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"\n\/*\n * This file is composed by \"extender\"\n * Merged class with parts of files:\n * - base.php\n *\/\n\nnamespace Fixture\\BaseExtension\\Domain\\Model;\n\nuse Evoweb\\Domain\\Model\\Test;\nclass ComposeMergedFileCode\n{\n use Evoweb\\TestTrait;\n protected $testProperty;\n public function __construct()\n {\n }\n function getTestProperty()\n {\n }\n}"
"\n\/*\n * This file is composed by \"extender\"\n * Merged class with parts of files:\n * - base.php\n *\/\n\nnamespace EvowebTests\\BaseExtension\\Domain\\Model;\n\nuse Evoweb\\Domain\\Model\\Test;\nclass ComposeMergedFileCode\n{\n use Evoweb\\TestTrait;\n protected $testProperty;\n public function __construct()\n {\n }\n function getTestProperty()\n {\n }\n}"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"filePath":"\/base_extension\/Classes\/Domain\/Model\/GetFileSegments.php","baseClass":false,"code":"<?php\n\n\/*\n * This file is developed by evoWeb.\n *\n * It is free software; you can redistribute it and\/or modify it under\n * the terms of the GNU General Public License, either version 2\n * of the License, or any later version.\n *\n * For the full copyright and license information, please read the\n * LICENSE.txt file that was distributed with this source code.\n *\/\n\nnamespace Fixture\\BaseExtension\\Domain\\Model;\n\nclass GetFileSegments\n{\n use Fixture\\BaseExtension\\TestTrait;\n\n protected string $testProperty = '';\n\n public function __construct() {}\n\n public function getTestProperty(): string\n {\n return $this->testProperty;\n }\n}\n","statements":[{"nodeType":"Stmt_Namespace","attributes":[],"name":{"nodeType":"Name","attributes":[],"name":"Fixture\\BaseExtension\\Domain\\Model"},"stmts":[]},{"nodeType":"UseItem","attributes":[],"type":0,"name":{"nodeType":"Name","attributes":[],"name":"Evoweb\\Domain\\Model\\Test"},"alias":null},{"nodeType":"Stmt_Class","attributes":[],"name":{"nodeType":"Identifier","attributes":[],"name":"GetFileSegments"},"stmts":[],"attrGroups":[],"flags":0,"extends":null,"implements":[]},{"nodeType":"Stmt_TraitUse","attributes":[],"traits":[{"nodeType":"Name","attributes":[],"name":"Evoweb\\TestTrait"}],"adaptations":[]},{"nodeType":"Stmt_Property","attributes":[],"flags":2,"props":[{"nodeType":"PropertyItem","attributes":[],"name":{"nodeType":"VarLikeIdentifier","attributes":[],"name":"testProperty"},"default":null}],"type":null,"attrGroups":[],"hooks":[]},{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"__construct"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]},{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"getTestProperty"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]}],"namespace":{"nodeType":"Name","attributes":[],"name":"Fixture\\BaseExtension\\Domain\\Model"},"uses":[{"nodeType":"UseItem","attributes":[],"type":0,"name":{"nodeType":"Name","attributes":[],"name":"Evoweb\\Domain\\Model\\Test"},"alias":null}],"class":{"nodeType":"Stmt_Class","attributes":[],"name":{"nodeType":"Identifier","attributes":[],"name":"GetFileSegments"},"stmts":[],"attrGroups":[],"flags":0,"extends":null,"implements":[]},"traits":[{"nodeType":"Stmt_TraitUse","attributes":[],"traits":[{"nodeType":"Name","attributes":[],"name":"Evoweb\\TestTrait"}],"adaptations":[]}],"properties":[{"nodeType":"Stmt_Property","attributes":[],"flags":2,"props":[{"nodeType":"PropertyItem","attributes":[],"name":{"nodeType":"VarLikeIdentifier","attributes":[],"name":"testProperty"},"default":null}],"type":null,"attrGroups":[],"hooks":[]}],"constructor":{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"__construct"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]},"methods":[{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"getTestProperty"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]}]}
{"filePath":"\/base_extension\/Classes\/Domain\/Model\/GetFileSegments.php","baseClass":false,"code":"<?php\n\n\/*\n * This file is developed by evoWeb.\n *\n * It is free software; you can redistribute it and\/or modify it under\n * the terms of the GNU General Public License, either version 2\n * of the License, or any later version.\n *\n * For the full copyright and license information, please read the\n * LICENSE.txt file that was distributed with this source code.\n *\/\n\nnamespace EvowebTests\\BaseExtension\\Domain\\Model;\n\nclass GetFileSegments\n{\n use \\EvowebTests\\BaseExtension\\Traits\\TestTrait;\n\n protected string $testProperty = '';\n\n public function __construct() {}\n\n public function getTestProperty(): string\n {\n return $this->testProperty;\n }\n}\n","statements":[{"nodeType":"Stmt_Namespace","attributes":[],"name":{"nodeType":"Name","attributes":[],"name":"EvowebTests\\BaseExtension\\Domain\\Model"},"stmts":[]},{"nodeType":"UseItem","attributes":[],"type":0,"name":{"nodeType":"Name","attributes":[],"name":"Evoweb\\Domain\\Model\\Test"},"alias":null},{"nodeType":"Stmt_Class","attributes":[],"name":{"nodeType":"Identifier","attributes":[],"name":"GetFileSegments"},"stmts":[],"attrGroups":[],"flags":0,"extends":null,"implements":[]},{"nodeType":"Stmt_TraitUse","attributes":[],"traits":[{"nodeType":"Name","attributes":[],"name":"Evoweb\\TestTrait"}],"adaptations":[]},{"nodeType":"Stmt_Property","attributes":[],"flags":2,"props":[{"nodeType":"PropertyItem","attributes":[],"name":{"nodeType":"VarLikeIdentifier","attributes":[],"name":"testProperty"},"default":null}],"type":null,"attrGroups":[],"hooks":[]},{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"__construct"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]},{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"getTestProperty"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]}],"namespace":{"nodeType":"Name","attributes":[],"name":"EvowebTests\\BaseExtension\\Domain\\Model"},"uses":[{"nodeType":"UseItem","attributes":[],"type":0,"name":{"nodeType":"Name","attributes":[],"name":"Evoweb\\Domain\\Model\\Test"},"alias":null}],"class":{"nodeType":"Stmt_Class","attributes":[],"name":{"nodeType":"Identifier","attributes":[],"name":"GetFileSegments"},"stmts":[],"attrGroups":[],"flags":0,"extends":null,"implements":[]},"traits":[{"nodeType":"Stmt_TraitUse","attributes":[],"traits":[{"nodeType":"Name","attributes":[],"name":"Evoweb\\TestTrait"}],"adaptations":[]}],"properties":[{"nodeType":"Stmt_Property","attributes":[],"flags":2,"props":[{"nodeType":"PropertyItem","attributes":[],"name":{"nodeType":"VarLikeIdentifier","attributes":[],"name":"testProperty"},"default":null}],"type":null,"attrGroups":[],"hooks":[]}],"constructor":{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"__construct"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]},"methods":[{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"getTestProperty"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]}]}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"filePath":"\/base_extension\/Classes\/Domain\/Model\/GetFileSegments.php","baseClass":false,"code":"<?php\n\n\/*\n * This file is developed by evoWeb.\n *\n * It is free software; you can redistribute it and\/or modify it under\n * the terms of the GNU General Public License, either version 2\n * of the License, or any later version.\n *\n * For the full copyright and license information, please read the\n * LICENSE.txt file that was distributed with this source code.\n *\/\n\nnamespace Fixture\\BaseExtension\\Domain\\Model;\n\nclass GetFileSegments\n{\n use Fixture\\BaseExtension\\TestTrait;\n\n protected string $testProperty = '';\n\n public function __construct() {}\n\n public function getTestProperty(): string\n {\n return $this->testProperty;\n }\n}\n","statements":[{"nodeType":"Stmt_Namespace","attributes":[],"name":{"nodeType":"Name","attributes":[],"name":"Fixture\\BaseExtension\\Domain\\Model"},"stmts":[]},{"nodeType":"UseItem","attributes":[],"type":0,"name":{"nodeType":"Name","attributes":[],"name":"Evoweb\\Domain\\Model\\Test"},"alias":null},{"nodeType":"Stmt_Class","attributes":[],"name":{"nodeType":"Identifier","attributes":[],"name":"GetFileSegments"},"stmts":[],"attrGroups":[],"flags":0,"extends":null,"implements":[]},{"nodeType":"Stmt_TraitUse","attributes":[],"traits":[{"nodeType":"Name","attributes":[],"name":"Evoweb\\TestTrait"}],"adaptations":[]},{"nodeType":"Stmt_Property","attributes":[],"flags":2,"props":[{"nodeType":"PropertyItem","attributes":[],"name":{"nodeType":"VarLikeIdentifier","attributes":[],"name":"testProperty"},"default":null}],"type":null,"attrGroups":[],"hooks":[]},{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"__construct"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]},{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"getTestProperty"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]}],"namespace":{"nodeType":"Name","attributes":[],"name":"Fixture\\BaseExtension\\Domain\\Model"},"uses":[{"nodeType":"UseItem","attributes":[],"type":0,"name":{"nodeType":"Name","attributes":[],"name":"Evoweb\\Domain\\Model\\Test"},"alias":null}],"class":{"nodeType":"Stmt_Class","attributes":[],"name":{"nodeType":"Identifier","attributes":[],"name":"GetFileSegments"},"stmts":[],"attrGroups":[],"flags":0,"extends":null,"implements":[]},"traits":[{"nodeType":"Stmt_TraitUse","attributes":[],"traits":[{"nodeType":"Name","attributes":[],"name":"Evoweb\\TestTrait"}],"adaptations":[]}],"properties":[{"nodeType":"Stmt_Property","attributes":[],"flags":2,"props":[{"nodeType":"PropertyItem","attributes":[],"name":{"nodeType":"VarLikeIdentifier","attributes":[],"name":"testProperty"},"default":null}],"type":null,"attrGroups":[],"hooks":[]}],"constructor":{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"__construct"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]},"methods":[{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"getTestProperty"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]}]}
{"filePath":"\/base_extension\/Classes\/Domain\/Model\/GetFileSegments.php","baseClass":false,"code":"<?php\n\n\/*\n * This file is developed by evoWeb.\n *\n * It is free software; you can redistribute it and\/or modify it under\n * the terms of the GNU General Public License, either version 2\n * of the License, or any later version.\n *\n * For the full copyright and license information, please read the\n * LICENSE.txt file that was distributed with this source code.\n *\/\n\nnamespace EvowebTests\\BaseExtension\\Domain\\Model;\n\nclass GetFileSegments\n{\n use \\EvowebTests\\BaseExtension\\Traits\\TestTrait;\n\n protected string $testProperty = '';\n\n public function __construct() {}\n\n public function getTestProperty(): string\n {\n return $this->testProperty;\n }\n}\n","statements":[{"nodeType":"Stmt_Namespace","attributes":[],"name":{"nodeType":"Name","attributes":[],"name":"EvowebTests\\BaseExtension\\Domain\\Model"},"stmts":[]},{"nodeType":"UseItem","attributes":[],"type":0,"name":{"nodeType":"Name","attributes":[],"name":"Evoweb\\Domain\\Model\\Test"},"alias":null},{"nodeType":"Stmt_Class","attributes":[],"name":{"nodeType":"Identifier","attributes":[],"name":"GetFileSegments"},"stmts":[],"attrGroups":[],"flags":0,"extends":null,"implements":[]},{"nodeType":"Stmt_TraitUse","attributes":[],"traits":[{"nodeType":"Name","attributes":[],"name":"Evoweb\\TestTrait"}],"adaptations":[]},{"nodeType":"Stmt_Property","attributes":[],"flags":2,"props":[{"nodeType":"PropertyItem","attributes":[],"name":{"nodeType":"VarLikeIdentifier","attributes":[],"name":"testProperty"},"default":null}],"type":null,"attrGroups":[],"hooks":[]},{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"__construct"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]},{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"getTestProperty"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]}],"namespace":{"nodeType":"Name","attributes":[],"name":"EvowebTests\\BaseExtension\\Domain\\Model"},"uses":[{"nodeType":"UseItem","attributes":[],"type":0,"name":{"nodeType":"Name","attributes":[],"name":"Evoweb\\Domain\\Model\\Test"},"alias":null}],"class":{"nodeType":"Stmt_Class","attributes":[],"name":{"nodeType":"Identifier","attributes":[],"name":"GetFileSegments"},"stmts":[],"attrGroups":[],"flags":0,"extends":null,"implements":[]},"traits":[{"nodeType":"Stmt_TraitUse","attributes":[],"traits":[{"nodeType":"Name","attributes":[],"name":"Evoweb\\TestTrait"}],"adaptations":[]}],"properties":[{"nodeType":"Stmt_Property","attributes":[],"flags":2,"props":[{"nodeType":"PropertyItem","attributes":[],"name":{"nodeType":"VarLikeIdentifier","attributes":[],"name":"testProperty"},"default":null}],"type":null,"attrGroups":[],"hooks":[]}],"constructor":{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"__construct"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]},"methods":[{"nodeType":"Stmt_ClassMethod","attributes":[],"flags":0,"byRef":false,"name":{"nodeType":"Identifier","attributes":[],"name":"getTestProperty"},"params":[],"returnType":null,"stmts":[],"attrGroups":[]}]}
4 changes: 2 additions & 2 deletions Tests/Functional/Composer/ClassComposerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function composeMergedFileCode(): void
$fileSegments->setFilePath($basePath);
$fileSegments->setBaseClass(true);
$fileSegments->setCode($code);
$fileSegments->setNamespace(new Node\Name('Fixture\BaseExtension\Domain\Model'));
$fileSegments->setNamespace(new Node\Name('EvowebTests\BaseExtension\Domain\Model'));
$fileSegments->addUseUse(new Stmt\UseUse(new Node\Name('Evoweb\Domain\Model\Test')));
$fileSegments->setClass(new Stmt\Class_('ComposeMergedFileCode'));
$fileSegments->addTrait(new Stmt\TraitUse([new Node\Name('Evoweb\TestTrait')]));
Expand Down Expand Up @@ -74,7 +74,7 @@ public function addFileStatement(
}
};

$namespaceName = new Node\Name('Fixture\BaseExtension\Domain\Model');
$namespaceName = new Node\Name('EvowebTests\BaseExtension\Domain\Model');

$fileSegments = new FileSegments();
$fileSegments->setBaseClass(true);
Expand Down
4 changes: 2 additions & 2 deletions Tests/Functional/Loader/ClassLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function extendedClassIsOfBaseType(): void
$classRegister
);

$expected = 'Fixture\BaseExtension\Domain\Model\Blob';
$expected = 'EvowebTests\BaseExtension\Domain\Model\Blob';
$subject = new ClassLoader($classCache, $classCacheManager, $classRegister);
$subject->loadClass($expected);

Expand Down Expand Up @@ -128,7 +128,7 @@ public function extendedClassHasOtherProperty(): void
$classRegister
);

$className = 'Fixture\BaseExtension\Domain\Model\Blob';
$className = 'EvowebTests\BaseExtension\Domain\Model\Blob';
$subject = new ClassLoader($classCache, $classCacheManager, $classRegister);
$subject->loadClass($className);

Expand Down
4 changes: 2 additions & 2 deletions Tests/Functional/Parser/ClassParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getFileSegments(): void
->disableOriginalConstructor()
->getMock();
$parser->expects(self::once())->method('parse')->willReturn([
new Stmt\Namespace_(new Node\Name('Fixture\BaseExtension\Domain\Model')),
new Stmt\Namespace_(new Node\Name('EvowebTests\BaseExtension\Domain\Model')),
new Node\UseItem(new Node\Name('Evoweb\Domain\Model\Test')),
new Stmt\Class_('GetFileSegments'),
new Stmt\TraitUse([new Node\Name('Evoweb\TestTrait')]),
Expand Down Expand Up @@ -82,7 +82,7 @@ public function traverseStatements(FileSegments $fileSegment, string $visitorCla
}
};

$expected = new Node\Name('Fixture\BaseExtension\Domain\Model');
$expected = new Node\Name('EvowebTests\BaseExtension\Domain\Model');

$fileSegment = new FileSegments();
$fileSegment->setStatements([new Stmt\Namespace_($expected)]);
Expand Down

0 comments on commit 8dac7a4

Please sign in to comment.