Skip to content

Commit

Permalink
minor PHP-CS-Fixer#1420 AlignDoubleArrowFixer, AlignEqualsFixer - add…
Browse files Browse the repository at this point in the history
… integration tests (keradus)

This PR was merged into the 1.11 branch.

Discussion
----------

AlignDoubleArrowFixer, AlignEqualsFixer - add integration tests

Add tests for PHP-CS-Fixer#1419

Commits
-------

26bffdc AlignDoubleArrowFixer, AlignEqualsFixer - add integration tests
  • Loading branch information
keradus committed Sep 27, 2015
2 parents a47b1ed + 26bffdc commit 3d666f1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Symfony/CS/Tests/AbstractIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static function setUpBeforeClass()

public static function tearDownAfterClass()
{
unlink(static::getTempFile());
@unlink(static::getTempFile());
}

/**
Expand Down Expand Up @@ -162,7 +162,7 @@ protected function doTestIntegration($testFileName, $testTitle, $fixers, $input,
}

$this->assertNotEmpty($changed, sprintf('Expected changes made to test "%s" in "%s".', $testTitle, $testFileName));
$this->assertSame($expected, file_get_contents($tmpFile), sprintf('Expected changes do not match result, for "%s" in "%s".', $testTitle, $testFileName));
$this->assertSame($expected, file_get_contents($tmpFile), sprintf('Expected changes do not match result for "%s" in "%s".', $testTitle, $testFileName));

// run the test again with the `expected` part, this should always stay the same
$this->testIntegration($testFileName, $testTitle.' "--EXPECT-- part run"', $fixers, $expected);
Expand Down Expand Up @@ -236,7 +236,7 @@ protected function getFixersFromConfig($fileName, $config)
}

$fixers = array();
for ($i = count(self::$builtInFixers) - 1; $i >= 0; --$i) {
for ($i = 0, $limit = count(self::$builtInFixers); $i < $limit; ++$i) {
$fixer = self::$builtInFixers[$i];
$fixerName = $fixer->getName();
if ('psr0' === $fixer->getName()) {
Expand Down
4 changes: 2 additions & 2 deletions Symfony/CS/Tests/FixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ public function getFixersPriorityCases()
array($fixers['standardize_not_equal'], $fixers['strict']),
array($fixers['double_arrow_multiline_whitespaces'], $fixers['multiline_array_trailing_comma']),
array($fixers['double_arrow_multiline_whitespaces'], $fixers['align_double_arrow']),
array($fixers['operators_spaces'], $fixers['align_double_arrow']),
array($fixers['operators_spaces'], $fixers['align_equals']),
array($fixers['operators_spaces'], $fixers['align_double_arrow']), // tested also in: align_double_arrow,operators_spaces.test
array($fixers['operators_spaces'], $fixers['align_equals']), // tested also in: align_double_arrow,align_equals.test
array($fixers['indentation'], $fixers['phpdoc_indent']),
array($fixers['phpdoc_order'], $fixers['phpdoc_separation']),
array($fixers['phpdoc_no_access'], $fixers['phpdoc_separation']),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
Integration of fixers: align_double_arrow,operators_spaces.
--CONFIG--
level=none
fixers=align_double_arrow,operators_spaces
--INPUT--
<?php
$array = [
'€ 1,00 (23,00% IVA incluído)'=> 1,
'€ 3.542,90 (23,00% IVA incluído)'=> 3543,
'€ 4.200,00' => 4200,
];

--EXPECT--
<?php
$array = [
'€ 1,00 (23,00% IVA incluído)' => 1,
'€ 3.542,90 (23,00% IVA incluído)' => 3543,
'€ 4.200,00' => 4200,
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
Integration of fixers: align_equals,operators_spaces.
--CONFIG--
level=none
fixers=align_equals,operators_spaces
--INPUT--
<?php
$FOO€BARí= 123;
$FOO€BARíBAZ= 123;
$FOO = 123;

--EXPECT--
<?php
$FOO€BARí = 123;
$FOO€BARíBAZ = 123;
$FOO = 123;

0 comments on commit 3d666f1

Please sign in to comment.