forked from subins2000/phpF
-
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.
Merge branch 'AlignPHPCode2' into dev
- Loading branch information
Showing
4 changed files
with
234 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
class TestAlignPHPCode extends PHPUnit_Framework_TestCase { | ||
|
||
/** | ||
* @var string Code to test | ||
*/ | ||
private $code = <<<CODE | ||
<?php | ||
require 'foo.php'; | ||
?> | ||
<div> | ||
<?php | ||
echo 'foo'; | ||
?> | ||
</div> | ||
CODE; | ||
|
||
public function testEnabled() { | ||
$output = executeCommand( | ||
array( | ||
'--passes' => 'AlignPHPCode', | ||
), | ||
$this->code | ||
); | ||
|
||
$expected_result = <<<CODE | ||
<?php | ||
require 'foo.php'; | ||
?> | ||
<div> | ||
<?php | ||
echo 'foo'; | ||
?> | ||
</div> | ||
CODE; | ||
|
||
$this->assertContains( $expected_result, $output ); | ||
} | ||
|
||
public function testDisabled() { | ||
$output = executeCommand( | ||
array( | ||
'--exclude' => 'AlignPHPCode', | ||
), | ||
$this->code | ||
); | ||
|
||
$expected_result = <<<CODE | ||
<?php | ||
require 'foo.php'; | ||
?> | ||
<div> | ||
<?php | ||
echo 'foo'; | ||
?> | ||
</div> | ||
CODE; | ||
|
||
$this->assertContains( $expected_result, $output ); | ||
} | ||
|
||
} |
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,72 @@ | ||
<?php | ||
|
||
class TestAlignPHPCode2 extends PHPUnit_Framework_TestCase { | ||
|
||
/** | ||
* @var string Code to test | ||
*/ | ||
private $code = <<<CODE | ||
<?php | ||
require 'foo.php'; | ||
?> | ||
<div> | ||
<?php | ||
echo 'foo'; | ||
if ('foo' === 'bar'){ | ||
} | ||
?> | ||
</div> | ||
CODE; | ||
|
||
public function testEnabled() { | ||
$output = executeCommand( | ||
array( | ||
'--passes' => 'AlignPHPCode2', | ||
), | ||
$this->code | ||
); | ||
|
||
$expected_result = <<<CODE | ||
<?php | ||
require 'foo.php'; | ||
?> | ||
<div> | ||
<?php | ||
echo 'foo'; | ||
if ('foo' === 'bar') { | ||
} | ||
?> | ||
</div> | ||
CODE; | ||
|
||
$this->assertContains( $expected_result, $output ); | ||
} | ||
|
||
public function testDisabled() { | ||
$output = executeCommand( | ||
array( | ||
'--exclude' => 'AlignPHPCode2', | ||
), | ||
$this->code | ||
); | ||
|
||
$expected_result = <<<CODE | ||
<?php | ||
require 'foo.php'; | ||
?> | ||
<div> | ||
<?php | ||
echo 'foo'; | ||
if ('foo' === 'bar') { | ||
} | ||
?> | ||
</div> | ||
CODE; | ||
|
||
$this->assertContains( $expected_result, $output ); | ||
} | ||
|
||
} |
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