Skip to content

Commit

Permalink
Merge 1f24b76 into d49733c
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jul 6, 2020
2 parents d49733c + 1f24b76 commit 8385eff
Show file tree
Hide file tree
Showing 29 changed files with 91 additions and 136 deletions.
21 changes: 11 additions & 10 deletions composer.json
Expand Up @@ -6,18 +6,19 @@
"require": {
"php": "^7.2",
"nette/utils": "^3.1",
"slevomat/coding-standard": "^6.2",
"slevomat/coding-standard": "^6.3",
"squizlabs/php_codesniffer": "^3.5"
},
"require-dev": {
"phpstan/phpstan": "^0.12.18",
"phpunit/phpunit": "^8.5|^9.0",
"rector/rector": "^0.7.9",
"symplify/changelog-linker": "^7.2",
"symplify/coding-standard": "^7.2",
"symplify/easy-coding-standard-tester": "^7.2",
"symplify/phpstan-extensions": "^7.2",
"tracy/tracy": "^2.7"
"rector/rector": "^0.7.43",
"symplify/changelog-linker": "^8.1",
"symplify/coding-standard": "^8.1",
"symplify/easy-coding-standard-tester": "^8.1",
"symplify/phpstan-extensions": "^8.1",
"tracy/tracy": "^2.7",
"phpstan/phpdoc-parser": "0.4.4 as 0.4.8"
},
"autoload": {
"psr-4": {
Expand All @@ -31,9 +32,9 @@
},
"scripts": {
"complete-check": ["@phpstan", "@check-cs", "phpunit"],
"phpstan": "phpstan analyze src tests --error-format symplify",
"check-cs": "ecs check",
"fix-cs": "ecs check --fix",
"phpstan": "phpstan analyze src tests --error-format symplify --ansi",
"check-cs": "ecs check --ansi",
"fix-cs": "ecs check --fix --ansi",
"changelog": "changelog-linker dump-merges",
"rector": "rector process --dry-run --config rector-ci.yaml --ansi"
}
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Expand Up @@ -10,7 +10,7 @@ parameters:
- src
- tests

autoload_files:
bootstrapFiles:
- 'tests/bootstrap.php'

ignoreErrors:
Expand Down
File renamed without changes.
18 changes: 9 additions & 9 deletions tests/Sniffs/Classes/ForbiddenPublicPropertySniffTest.php
Expand Up @@ -5,18 +5,18 @@
use Iterator;
use ObjectCalisthenics\Sniffs\Classes\ForbiddenPublicPropertySniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\EasyTesting\DataProvider\StaticFixtureFinder;
use Symplify\SmartFileSystem\SmartFileInfo;

/**
* @see ForbiddenPublicPropertySniff
*/
final class ForbiddenPublicPropertySniffTest extends AbstractCheckerTestCase
{
/**
* @dataProvider provideCorrectCases()
*/
public function testCorrectCases(string $file): void
{
$this->doTestCorrectFile($file);
$fileInfo = new SmartFileInfo($file);
$this->doTestFileInfo($fileInfo);
}

public function provideCorrectCases(): Iterator
Expand All @@ -27,18 +27,18 @@ public function provideCorrectCases(): Iterator
/**
* @dataProvider provideWrongCases()
*/
public function testWrongToFixed(string $wrongFile): void
public function testWrongToFixed(SmartFileInfo $wrongFile): void
{
$this->doTestWrongFile($wrongFile);
$this->doTestFileInfoWithErrorCountOf($wrongFile, 1);
}

public function provideWrongCases(): Iterator
{
yield [__DIR__ . '/wrong/wrong.php.inc'];
return StaticFixtureFinder::yieldDirectory(__DIR__ . '/Fixture');
}

protected function provideConfig(): string
protected function getCheckerClass(): string
{
return __DIR__ . '/config.yml';
return ForbiddenPublicPropertySniff::class;
}
}
20 changes: 9 additions & 11 deletions tests/Sniffs/CodeAnalysis/OneObjectOperatorPerLineSniffTest.php
Expand Up @@ -5,18 +5,18 @@
use Iterator;
use ObjectCalisthenics\Sniffs\CodeAnalysis\OneObjectOperatorPerLineSniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\EasyTesting\DataProvider\StaticFixtureFinder;
use Symplify\SmartFileSystem\SmartFileInfo;

/**
* @see OneObjectOperatorPerLineSniff
*/
final class OneObjectOperatorPerLineSniffTest extends AbstractCheckerTestCase
{
/**
* @dataProvider provideCorrectCases()
*/
public function testCorrectCases(string $file): void
{
$this->doTestCorrectFile($file);
$fileInfo = new SmartFileInfo($file);
$this->doTestFileInfo($fileInfo);
}

public function provideCorrectCases(): Iterator
Expand All @@ -27,20 +27,18 @@ public function provideCorrectCases(): Iterator
/**
* @dataProvider provideWrongCases()
*/
public function testWrongToFixed(string $wrongFile): void
public function testWrongToFixed(SmartFileInfo $wrongFileInfo): void
{
$this->doTestWrongFile($wrongFile);
$this->doTestFileInfoWithErrorCountOf($wrongFileInfo, 1);
}

public function provideWrongCases(): Iterator
{
yield [__DIR__ . '/wrong/wrong.php.inc'];
yield [__DIR__ . '/wrong/wrong2.php.inc'];
yield [__DIR__ . '/wrong/wrong3.php.inc'];
return StaticFixtureFinder::yieldDirectory(__DIR__ . '/Fixture');
}

protected function provideConfig(): string
protected function getCheckerClass(): string
{
return __DIR__ . '/config.yml';
return OneObjectOperatorPerLineSniff::class;
}
}
2 changes: 0 additions & 2 deletions tests/Sniffs/CodeAnalysis/config.yml

This file was deleted.

17 changes: 7 additions & 10 deletions tests/Sniffs/ControlStructures/NoElseSniffTest.php
Expand Up @@ -5,29 +5,26 @@
use Iterator;
use ObjectCalisthenics\Sniffs\ControlStructures\NoElseSniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\EasyTesting\DataProvider\StaticFixtureFinder;
use Symplify\SmartFileSystem\SmartFileInfo;

/**
* @see NoElseSniff
*/
final class NoElseSniffTest extends AbstractCheckerTestCase
{
/**
* @dataProvider provideWrongCases()
*/
public function testWrongToFixed(string $wrongFile): void
public function testWrongToFixed(SmartFileInfo $wrongFileInfo): void
{
$this->doTestWrongFile($wrongFile);
$this->doTestFileInfoWithErrorCountOf($wrongFileInfo, 1);
}

public function provideWrongCases(): Iterator
{
yield [__DIR__ . '/wrong/wrong.php.inc'];
yield [__DIR__ . '/wrong/wrong2.php.inc'];
yield [__DIR__ . '/wrong/wrong3.php.inc'];
return StaticFixtureFinder::yieldDirectory(__DIR__ . '/Fixture');
}

protected function provideConfig(): string
protected function getCheckerClass(): string
{
return __DIR__ . '/config.yml';
return NoElseSniff::class;
}
}
2 changes: 0 additions & 2 deletions tests/Sniffs/ControlStructures/config.yml

This file was deleted.

Expand Up @@ -3,7 +3,9 @@
namespace ObjectCalisthenics\Tests\Sniffs\Files\ClassTraitAndInterfaceLength;

use Iterator;
use ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

final class ClassTraitAndInterfaceLengthSniffTest extends AbstractCheckerTestCase
{
Expand All @@ -12,7 +14,8 @@ final class ClassTraitAndInterfaceLengthSniffTest extends AbstractCheckerTestCas
*/
public function testWrongToFixed(string $wrongFile): void
{
$this->doTestWrongFile($wrongFile);
$wrongFileInfo = new SmartFileInfo($wrongFile);
$this->doTestFileInfoWithErrorCountOf($wrongFileInfo, 1);
}

public function provideWrongCases(): Iterator
Expand All @@ -22,8 +25,8 @@ public function provideWrongCases(): Iterator
yield [__DIR__ . '/wrong/wrong3.php.inc'];
}

protected function provideConfig(): string
protected function getCheckerClass(): string
{
return __DIR__ . '/config.yml';
return ClassTraitAndInterfaceLengthSniff::class;
}
}
2 changes: 0 additions & 2 deletions tests/Sniffs/Files/ClassTraitAndInterfaceLength/config.yml

This file was deleted.

11 changes: 5 additions & 6 deletions tests/Sniffs/Files/FunctionLength/FunctionLengthSniffTest.php
Expand Up @@ -5,18 +5,17 @@
use Iterator;
use ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

/**
* @see FunctionLengthSniff
*/
final class FunctionLengthSniffTest extends AbstractCheckerTestCase
{
/**
* @dataProvider provideWrongCases()
*/
public function testWrongToFixed(string $wrongFile): void
{
$this->doTestWrongFile($wrongFile);
$wrongFileInfo = new SmartFileInfo($wrongFile);
$this->doTestFileInfoWithErrorCountOf($wrongFileInfo, 1);
}

public function provideWrongCases(): Iterator
Expand All @@ -25,8 +24,8 @@ public function provideWrongCases(): Iterator
yield [__DIR__ . '/wrong/wrong2.php.inc'];
}

protected function provideConfig(): string
protected function getCheckerClass(): string
{
return __DIR__ . '/config.yml';
return FunctionLengthSniff::class;
}
}
2 changes: 0 additions & 2 deletions tests/Sniffs/Files/FunctionLength/config.yml

This file was deleted.

22 changes: 6 additions & 16 deletions tests/Sniffs/Metrics/MaxNestingLevel/MaxNestingLevelSniffTest.php
Expand Up @@ -2,30 +2,20 @@

namespace ObjectCalisthenics\Tests\Sniffs\Metrics\MaxNestingLevel;

use Iterator;
use ObjectCalisthenics\Sniffs\Metrics\MaxNestingLevelSniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

/**
* @see MaxNestingLevelSniff
*/
final class MaxNestingLevelSniffTest extends AbstractCheckerTestCase
{
/**
* @dataProvider provideWrongCases()
*/
public function testWrongToFixed(string $wrongFile): void
public function testWrongToFixed(): void
{
$this->doTestWrongFile($wrongFile);
$fileInfo = new SmartFileInfo(__DIR__ . '/wrong/wrong.php.inc');
$this->doTestFileInfo($fileInfo);
}

public function provideWrongCases(): Iterator
protected function getCheckerClass(): string
{
yield [__DIR__ . '/wrong/wrong.php.inc'];
}

protected function provideConfig(): string
{
return __DIR__ . '/config.yml';
return MaxNestingLevelSniff::class;
}
}
2 changes: 0 additions & 2 deletions tests/Sniffs/Metrics/MaxNestingLevel/config.yml

This file was deleted.

Expand Up @@ -2,26 +2,20 @@

namespace ObjectCalisthenics\Tests\Sniffs\Metrics\MethodPerClassLimit;

use Iterator;
use ObjectCalisthenics\Sniffs\Metrics\MethodPerClassLimitSniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

final class MethodPerClassLimitSniffTest extends AbstractCheckerTestCase
{
/**
* @dataProvider provideWrongCases()
*/
public function testWrongToFixed(string $wrongFile): void
public function testWrongToFixed(): void
{
$this->doTestWrongFile($wrongFile);
$fileInfo = new SmartFileInfo(__DIR__ . '/wrong/wrong.php.inc');
$this->doTestFileInfo($fileInfo);
}

public function provideWrongCases(): Iterator
protected function getCheckerClass(): string
{
yield [__DIR__ . '/wrong/wrong.php.inc'];
}

protected function provideConfig(): string
{
return __DIR__ . '/config.yml';
return MethodPerClassLimitSniff::class;
}
}
2 changes: 0 additions & 2 deletions tests/Sniffs/Metrics/MethodPerClassLimit/config.yml

This file was deleted.

Expand Up @@ -3,7 +3,9 @@
namespace ObjectCalisthenics\Tests\Sniffs\Metrics\PropertyPerClassLimit;

use Iterator;
use ObjectCalisthenics\Sniffs\Metrics\PropertyPerClassLimitSniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\SmartFileSystem\SmartFileInfo;

final class PropertyPerClassLimitSniffTest extends AbstractCheckerTestCase
{
Expand All @@ -12,29 +14,23 @@ final class PropertyPerClassLimitSniffTest extends AbstractCheckerTestCase
*/
public function testCorrectCases(string $file): void
{
$this->doTestCorrectFile($file);
$fileInfo = new SmartFileInfo($file);
$this->doTestFileInfo($fileInfo);
}

public function provideCorrectCases(): Iterator
{
yield [__DIR__ . '/correct/correct.php.inc'];
}

/**
* @dataProvider provideWrongCases()
*/
public function testWrongToFixed(string $wrongFile): void
{
$this->doTestWrongFile($wrongFile);
}

public function provideWrongCases(): Iterator
public function testWrongToFixed(): void
{
yield [__DIR__ . '/wrong/wrong.php.inc'];
$fileInfo = new SmartFileInfo(__DIR__ . '/wrong/wrong.php.inc');
$this->doTestFileInfoWithErrorCountOf($fileInfo, 1);
}

protected function provideConfig(): string
protected function getCheckerClass(): string
{
return __DIR__ . '/config.yml';
return PropertyPerClassLimitSniff::class;
}
}
2 changes: 0 additions & 2 deletions tests/Sniffs/Metrics/PropertyPerClassLimit/config.yml

This file was deleted.

0 comments on commit 8385eff

Please sign in to comment.