Ecodev /
felix
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace EcodevTests\Felix\Acl; |
||
| 6 | |||
| 7 | use Ecodev\Felix\Acl\ModelResource; |
||
|
1 ignored issue
–
show
|
|||
| 8 | use EcodevTests\Felix\Blog\Model\User; |
||
| 9 | use InvalidArgumentException; |
||
| 10 | use PHPUnit\Framework\TestCase; |
||
| 11 | |||
| 12 | final class ModelResourceTest extends TestCase |
||
| 13 | { |
||
| 14 | public function testConstructorVariants(): void |
||
| 15 | { |
||
| 16 | // Constructor with pre-loaded model |
||
| 17 | $user = new User(); |
||
| 18 | $resource = new ModelResource(User::class, $user); |
||
| 19 | self::assertSame($user, $resource->getInstance(), 'should be able to get back model'); |
||
| 20 | self::assertSame('User#null', $resource->getName(), 'should have unique name'); |
||
| 21 | |||
| 22 | $resourceWithoutInstance = new ModelResource(User::class); |
||
| 23 | self::assertSame('User#null', $resourceWithoutInstance->getName(), 'should have name even without instance'); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function testUnknownClassMustThrow(): void |
||
| 27 | { |
||
| 28 | $this->expectException(InvalidArgumentException::class); |
||
| 29 | |||
| 30 | new ModelResource('non-existing-class-name'); |
||
| 31 | } |
||
| 32 | } |
||
| 33 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths