-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from preprocess/refactor-for-new-plugin
Refactor for new plugin
- Loading branch information
Showing
7 changed files
with
40 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
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.
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,13 +1,42 @@ | ||
<?php | ||
|
||
namespace Pre\Six; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
use Pre\Plugin\Testing\Runner; | ||
|
||
class MacroTest extends Runner | ||
class MacroTest extends TestCase | ||
{ | ||
protected function path(): string | ||
/** | ||
* @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 __DIR__ . "/specs"; | ||
return "<?php\n\n" . trim($code) . "\n"; | ||
} | ||
|
||
public static function specs() | ||
{ | ||
$specs = []; | ||
|
||
$files = [ | ||
__DIR__ . "/specs/six.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 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