Skip to content

Commit a61c561

Browse files
committed
Fix test implementation
1 parent f58b6c0 commit a61c561

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"SaschaEgerer\\PhpstanTypo3\\Tests\\": "tests/"
3636
},
3737
"files": [
38-
"tests/Unit/Type/data/repository-stub-files.php"
38+
"tests/Unit/Type/data/repository-stub-files.php",
39+
"tests/Unit/Type/QueryResultToArrayDynamicReturnTypeExtension/data/query-result-to-array.php"
3940
]
4041
},
4142
"extra": {

tests/Unit/Type/QueryResultToArrayDynamicReturnTypeExtension/data/query-result-to-array.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
66
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
7-
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
87
use TYPO3\CMS\Extbase\Persistence\Repository;
9-
use TYPO3\CMS\Extbase\Persistence\RepositoryInterface;
108
use function PHPStan\Testing\assertType;
119

1210
/**
1311
* @extends Repository<FrontendUserGroup>
1412
*/
15-
class FrontendUserGroupRepository extends Repository implements RepositoryInterface
13+
class FrontendUserGroupRepository extends Repository
1614
{
1715

1816
}
@@ -33,10 +31,18 @@ public function __construct(FrontendUserGroupRepository $myRepository)
3331
$this->myRepository = $myRepository;
3432
}
3533

36-
public function showAction()
34+
public function showAction(): void
3735
{
36+
assertType(
37+
'array<int, SaschaEgerer\PhpstanTypo3\Tests\Unit\Type\QueryResultToArrayDynamicReturnTypeExtension\FrontendUserGroup>',
38+
$this->myRepository->findAll()->toArray()
39+
);
40+
3841
$queryResult = $this->myRepository->findAll();
3942
$myObjects = $queryResult->toArray();
40-
assertType('array<int, FrontendUserGroup>', $myObjects);
43+
assertType(
44+
'array<int, SaschaEgerer\PhpstanTypo3\Tests\Unit\Type\QueryResultToArrayDynamicReturnTypeExtension\FrontendUserGroup>',
45+
$myObjects
46+
);
4147
}
4248
}

0 commit comments

Comments
 (0)