Skip to content

Commit

Permalink
Merge pull request #3575 from morozov/tests-types
Browse files Browse the repository at this point in the history
Enforced parameter and return value types in test classes
  • Loading branch information
morozov authored May 30, 2019
2 parents a2450fb + 631ff64 commit eb80fcb
Show file tree
Hide file tree
Showing 183 changed files with 2,469 additions and 1,952 deletions.
11 changes: 9 additions & 2 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@

<rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<exclude name="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing.IncorrectLinesCountAfterLastControlStructure"/>
<exclude name="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants.DisallowedLateStaticBindingForConstant"/>
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint">
<exclude-pattern>*/lib/*</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint">
<exclude-pattern>*/lib/*</exclude-pattern>
</rule>

<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
Expand All @@ -43,6 +49,7 @@
<rule ref="Squiz.Commenting.FunctionComment.InvalidNoReturn">
<exclude-pattern>lib/Doctrine/DBAL/Platforms/AbstractPlatform.php</exclude-pattern>
<exclude-pattern>lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php</exclude-pattern>
</rule>

<!-- some statement classes close cursor using an empty while-loop -->
Expand Down
10 changes: 5 additions & 5 deletions tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function setUp() : void
$this->queryCacheProfile = new QueryCacheProfile(self::LIFETIME, self::CACHE_KEY);
}

public function testShouldUseTheGivenCacheKeyIfPresent()
public function testShouldUseTheGivenCacheKeyIfPresent() : void
{
[$cacheKey] = $this->queryCacheProfile->generateCacheKeys(
$this->query,
Expand All @@ -50,7 +50,7 @@ public function testShouldUseTheGivenCacheKeyIfPresent()
self::assertEquals(self::CACHE_KEY, $cacheKey, 'The returned cache key should match the given one');
}

public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven()
public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);

Expand All @@ -70,7 +70,7 @@ public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven()
self::assertNotEmpty($cacheKey, 'The generated cache key should not be empty');
}

public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferentConnections()
public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferentConnections() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);

Expand All @@ -93,7 +93,7 @@ public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferent
self::assertNotEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be different');
}

public function testConnectionParamsShouldBeHashed()
public function testConnectionParamsShouldBeHashed() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);

Expand All @@ -114,7 +114,7 @@ public function testConnectionParamsShouldBeHashed()
}
}

public function testShouldGenerateSameKeysIfNoneOfTheParamsChanges()
public function testShouldGenerateSameKeysIfNoneOfTheParamsChanges() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);

Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/DBAL/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function setUp() : void
*
* @group DBAL-81
*/
public function testReturnsDefaultConnectionAutoCommitMode()
public function testReturnsDefaultConnectionAutoCommitMode() : void
{
self::assertTrue($this->config->getAutoCommit());
}
Expand All @@ -40,7 +40,7 @@ public function testReturnsDefaultConnectionAutoCommitMode()
*
* @group DBAL-81
*/
public function testSetsDefaultConnectionAutoCommitMode()
public function testSetsDefaultConnectionAutoCommitMode() : void
{
$this->config->setAutoCommit(false);

Expand Down
Loading

0 comments on commit eb80fcb

Please sign in to comment.