forked from coenjacobs/mozart
-
Notifications
You must be signed in to change notification settings - Fork 25
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
ef17e02
commit d041941
Showing
3 changed files
with
108 additions
and
2 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
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,78 @@ | ||
<?php | ||
/** | ||
* `use GlobalClass as Alias;` should be replaced with `use Prefixed_GlobalClass as Alias;`. | ||
* | ||
* | ||
* | ||
* @see https://github.com/BrianHenryIE/strauss/issues/108 | ||
*/ | ||
|
||
namespace BrianHenryIE\Strauss\Tests\Issues; | ||
|
||
use BrianHenryIE\Strauss\Tests\Integration\Util\IntegrationTestCase; | ||
|
||
/** | ||
* @package BrianHenryIE\Strauss\Tests\Issues | ||
* @coversNothing | ||
*/ | ||
class StraussIssue108Test extends IntegrationTestCase | ||
{ | ||
public function test_correct_directory_permission() | ||
{ | ||
$composerJsonString = <<<'EOD' | ||
{ | ||
"name": "strauss/issue108", | ||
"require": { | ||
"erusev/parsedown": "1.7.4" | ||
}, | ||
"autoload": { | ||
"classmap": [ | ||
"src/" | ||
] | ||
}, | ||
"extra": { | ||
"strauss": { | ||
"namespace_prefix": "Strauss\\Issue108\\", | ||
"classmap_prefix": "Prefixed_", | ||
"override_autoload": { | ||
"erusev/parsedown": { | ||
"classmap": [ | ||
"." | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
EOD; | ||
|
||
$replacementfile = <<<'EOD' | ||
<?php | ||
use Parsedown as MarkdownParser; | ||
class MyClass { | ||
public function myFunction() { | ||
$parsedown = new MarkdownParser(); | ||
} | ||
} | ||
EOD; | ||
|
||
chdir($this->testsWorkingDir); | ||
|
||
file_put_contents($this->testsWorkingDir . '/composer.json', $composerJsonString); | ||
|
||
@mkdir($this->testsWorkingDir . 'src'); | ||
$replacementfilePath = $this->testsWorkingDir . '/src/file.php'; | ||
file_put_contents($replacementfilePath, $replacementfile); | ||
|
||
exec('composer install'); | ||
|
||
$this->runStrauss(); | ||
|
||
$php_string = file_get_contents($replacementfilePath); | ||
|
||
self::assertStringNotContainsString("use Parsedown as MarkdownParser;", $php_string); | ||
self::assertStringContainsString("use Prefixed_Parsedown as MarkdownParser;", $php_string); | ||
} | ||
} |
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