-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #111 - added ignoring marked files for codestyle configuration * #111 - readme update * #111 - cr fix
- Loading branch information
1 parent
f39ca63
commit b92da75
Showing
6 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Blumilk\Codestyle\Tests; | ||
|
||
use Exception; | ||
|
||
class IgnoreMarkedFilesTest extends CodestyleTestCase | ||
{ | ||
/** | ||
* @throws Exception | ||
*/ | ||
public function testIgnoreMarkedFiles(): void | ||
{ | ||
$this->testFixture("ignoreMarkedFiles"); | ||
} | ||
|
||
protected function getConfigPath(): string | ||
{ | ||
return "./tests/codestyle/config/config.ignoreMarkedFiles.php"; | ||
} | ||
|
||
/** | ||
* @dataProvider providePhp80Fixtures | ||
* @throws Exception | ||
*/ | ||
protected function testFixture(string $name): void | ||
{ | ||
copy(__DIR__ . "/../fixtures/{$name}/actual.php", __DIR__ . "/tmp/{$name}.php"); | ||
|
||
$this->assertTrue( | ||
$this->runFixer(fix: true), | ||
"Fixture fixtures/{$name} was not proceeded properly.", | ||
); | ||
|
||
$this->assertFileEquals( | ||
__DIR__ . "/../fixtures/{$name}/expected.php", | ||
__DIR__ . "/tmp/{$name}.php", | ||
"Result of proceeded fixture fixtures/{$name} is not equal to expected.", | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Blumilk\Codestyle\Config; | ||
use Blumilk\Codestyle\Configuration\Defaults\CommonRules; | ||
use Blumilk\Codestyle\Configuration\Defaults\Paths; | ||
use PhpCsFixer\Fixer\Basic\PsrAutoloadingFixer; | ||
|
||
$paths = new Paths("tests/codestyle/tmp"); | ||
$rules = new CommonRules(); | ||
|
||
$config = new Config( | ||
paths: $paths, | ||
rules: $rules->filter(PsrAutoloadingFixer::class), | ||
); | ||
|
||
return $config->ignoreMarkedFiles()->config(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
// php-cs-fixer:ignore-file | ||
|
||
class Filter | ||
{ | ||
//example comment for ignored file | ||
public static function even($array){ | ||
return array_filter($array, | ||
fn (int $i) => | ||
$i | ||
% | ||
2 === 0 | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
// php-cs-fixer:ignore-file | ||
|
||
class Filter | ||
{ | ||
//example comment for ignored file | ||
public static function even($array){ | ||
return array_filter($array, | ||
fn (int $i) => | ||
$i | ||
% | ||
2 === 0 | ||
); | ||
} | ||
} |