-
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.
- Loading branch information
1 parent
35a02c5
commit c8b5c8a
Showing
7 changed files
with
82 additions
and
55 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
File renamed without changes.
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,44 @@ | ||
<?php | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
putenv("PRE_BASE_DIR=" . realpath(__DIR__ . "/../")); | ||
|
||
class MacroTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* @dataProvider specs | ||
*/ | ||
public function can_transform_code($from, $expected) | ||
{ | ||
Pre\Plugin\addMacro(__DIR__ . "/../source/macros.yay"); | ||
|
||
$actual = Pre\plugin\format(Pre\Plugin\parse($this->format($from))); | ||
$this->assertEquals($this->format($expected), $actual); | ||
} | ||
|
||
private function format($code) | ||
{ | ||
return "<?php\n\n" . trim($code) . "\n"; | ||
} | ||
|
||
public static function specs() | ||
{ | ||
$specs = []; | ||
|
||
$files = [ | ||
__DIR__ . "/specs/async.spec", | ||
]; | ||
|
||
foreach ($files as $file) { | ||
$contents = file_get_contents($file); | ||
|
||
foreach (explode("---", $contents) as $spec) { | ||
array_push($specs, explode("~~~", $spec)); | ||
} | ||
} | ||
|
||
return $specs; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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