-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d6cdc2c
commit a56b23b
Showing
10 changed files
with
107 additions
and
33 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/vendor | ||
/composer.lock | ||
/build_test | ||
/build | ||
.php_cs.cache |
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
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,80 @@ | ||
<?php | ||
/** | ||
* Author: Nil Portugués Calderó <contact@nilportugues.com> | ||
* Date: 11/4/15 | ||
* Time: 8:03 PM | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace NilPortugues\Tests\BackslashFixer\Fixer; | ||
|
||
use NilPortugues\BackslashFixer\Fixer\FileEditor; | ||
use NilPortugues\BackslashFixer\Fixer\FunctionRepository; | ||
use Zend\Code\Generator\FileGenerator; | ||
|
||
|
||
/** | ||
* Class FileEditorTest | ||
* @package NilPortugues\Tests\BackslashFixer\Fixer | ||
*/ | ||
class FileEditorTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var FileEditor | ||
*/ | ||
protected $fileEditor; | ||
|
||
/** | ||
* @var InMemoryFileSystem | ||
*/ | ||
protected $fileSystem; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $base; | ||
|
||
protected function setUp() | ||
{ | ||
$reflector = new \ReflectionClass(get_class($this)); | ||
$this->base = dirname($reflector->getFileName()); | ||
|
||
$this->fileSystem = new InMemoryFileSystem(); | ||
|
||
$this->fileEditor = new FileEditor( | ||
new FileGenerator(), | ||
new FunctionRepository(), | ||
$this->fileSystem | ||
); | ||
} | ||
|
||
public function testItCanBackSlashBooleansAndAndNull() | ||
{ | ||
$this->fileEditor->addBackslashes($this->base.'/Resources/BooleanAndNull.php'); | ||
$output = $this->fileSystem->getFile($this->base.'/Resources/BooleanAndNull.php'); | ||
|
||
$this->assertContains('\true', $output); | ||
$this->assertContains('\false', $output); | ||
$this->assertContains('\null', $output); | ||
|
||
} | ||
|
||
public function testItCanBackSlashConstants() | ||
{ | ||
$this->fileEditor->addBackslashes($this->base.'/Resources/Constant.php'); | ||
$output = $this->fileSystem->getFile($this->base.'/Resources/Constant.php'); | ||
|
||
$this->assertContains('$this->a = self::DIRECTORY_SEPARATOR;', $output); | ||
$this->assertContains('$this->b = \DIRECTORY_SEPARATOR;', $output); | ||
} | ||
|
||
public function testItCanBackSlashFunctions() | ||
{ | ||
$this->fileEditor->addBackslashes($this->base.'/Resources/Function.php'); | ||
$output = $this->fileSystem->getFile($this->base.'/Resources/Function.php'); | ||
|
||
$this->assertContains('return \strlen($string)', $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
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 0 additions & 24 deletions
24
tests/NilPortugues/Tests/BackslashFixer/Fixer/FunctionRepositoryTest.php
This file was deleted.
Oops, something went wrong.