Skip to content

Commit 3d45a0a

Browse files
committed
Run phpcs on tests folder
1 parent 23c56f6 commit 3d45a0a

File tree

7 files changed

+41
-29
lines changed

7 files changed

+41
-29
lines changed

phpcs.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?xml version="1.0"?>
2-
<ruleset name="PHPStan">
2+
<ruleset name="Source">
33
<arg name="colors"/>
44
<arg name="extensions" value="php"/>
55
<arg name="encoding" value="utf-8"/>
66
<arg name="tab-width" value="4"/>
77
<arg value="sp"/>
88
<file>src</file>
9+
<file>tests</file>
910

1011
<rule ref="vendor/consistence-community/coding-standard/Consistence/ruleset.xml">
1112
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat"/>

tests/Unit/Type/QueryFactoryStubFileTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public function dataFileAsserts(): iterable
1717

1818
/**
1919
* @dataProvider dataFileAsserts
20+
* @param string $assertType
21+
* @param string $file
2022
* @param mixed ...$args
2123
*/
2224
public function testFileAsserts(

tests/Unit/Type/RepositoryQueryDynamicReturnTypeExtensionTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public function dataFileAsserts(): iterable
1717

1818
/**
1919
* @dataProvider dataFileAsserts
20-
* @param mixed $args
20+
* @param string $assertType
21+
* @param string $file
22+
* @param mixed ...$args
2123
*/
2224
public function testFileAsserts(
2325
string $assertType,

tests/Unit/Type/RepositoryStubFileTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public function dataFileAsserts(): iterable
1717

1818
/**
1919
* @dataProvider dataFileAsserts
20+
* @param string $assertType
21+
* @param string $file
2022
* @param mixed ...$args
2123
*/
2224
public function testFileAsserts(

tests/Unit/Type/data/custom-query-type.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
<?php declare(strict_types = 1);
22

3+
// phpcs:disable SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile.MoreNamespacesInFile
4+
// phpcs:disable Squiz.Classes.ClassFileName.NoMatch
5+
// phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses
6+
37
namespace CustomQueryType\My\Test\Extension\Domain\Model;
48

59
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
610

7-
// Extbase naming convention says this model should be called MyModel, but we want to test that it also works if we
8-
// have a different model name
11+
// Extbase naming convention says this model should be called MyModel, but we want to test that it also works if we
12+
// have a different model name
913
class SomeOtherModel extends AbstractEntity
1014
{
1115

1216
}
1317

1418
namespace CustomQueryType\My\Test\Extension\Domain\Repository;
1519

16-
use CustomQueryType\My\Test\Extension\Domain\Model\SomeOtherModel;
17-
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
18-
use TYPO3\CMS\Extbase\Persistence\Repository;
19-
use function PHPStan\Testing\assertType;
20+
use CustomQueryType\My\Test\Extension\Domain\Model\SomeOtherModel;
21+
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
22+
use TYPO3\CMS\Extbase\Persistence\Repository;
23+
use function PHPStan\Testing\assertType;
2024

21-
/**
22-
* @extends Repository<SomeOtherModel>
23-
*/
25+
/**
26+
* @extends Repository<SomeOtherModel>
27+
*/
2428
class MyModelRepository extends Repository
2529
{
2630

tests/Unit/Type/data/query-factory-stub-files.php

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,26 @@
22

33
namespace QueryFactoryStubFile;
44

5-
use Psr\Container\ContainerInterface;
6-
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
7-
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory;
85
use TYPO3\CMS\Extbase\Persistence\Generic\QueryFactory;
6+
use function PHPStan\Testing\assertType;
97

8+
// phpcs:ignore Squiz.Classes.ClassFileName.NoMatch
109
class Model extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
1110
{
1211

13-
}
12+
public function foo(): void
13+
{
14+
$createResult = $this->getQueryFactory()->create(self::class);
1415

15-
use function PHPStan\Testing\assertType;
16+
assertType('TYPO3\CMS\Extbase\Persistence\QueryInterface<QueryFactoryStubFile\Model>', $createResult);
17+
assertType('class-string<' . self::class . '>', $createResult->getType());
18+
}
1619

17-
static function (): void {
18-
/** @var ConfigurationManager $configurationManager */
19-
$configurationManager = null;
20-
/** @var DataMapFactory $dataMapFactory */
21-
$dataMapFactory = null;
22-
/** @var ContainerInterface $containerInterface */
23-
$containerInterface = null;
20+
private function getQueryFactory(): QueryFactory
21+
{
22+
/** @var QueryFactory $queryFactory */
23+
$queryFactory = null;
24+
return $queryFactory;
25+
}
2426

25-
$queryFactory = new QueryFactory($configurationManager, $dataMapFactory, $containerInterface);
26-
$createResult = $queryFactory->create(Model::class);
27-
28-
assertType('TYPO3\CMS\Extbase\Persistence\QueryInterface<QueryFactoryStubFile\Model>', $createResult);
29-
assertType('class-string<' . Model::class . '>', $createResult->getType());
30-
};
27+
}

tests/Unit/Type/data/repository-stub-files.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php declare(strict_types = 1);
22

3+
// phpcs:disable SlevomatCodingStandard.Namespaces.RequireOneNamespaceInFile.MoreNamespacesInFile
4+
// phpcs:disable Squiz.Classes.ClassFileName.NoMatch
5+
// phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses
6+
37
namespace RepositoryStubFiles\My\Test\Extension\Domain\Model;
48

59
class MyModel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity

0 commit comments

Comments
 (0)