-
-
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.
closes #262
- Loading branch information
Showing
9 changed files
with
120 additions
and
10 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
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
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,18 @@ | ||
{ | ||
"/tmp/phpgt/build/*.txt": { | ||
"name": "Example dev TXT", | ||
"require": {}, | ||
"execute": { | ||
"command": "echo", | ||
"arguments": ["hello", "text"] | ||
} | ||
}, | ||
"/tmp/phpgt/build/*.md": { | ||
"name": "Example dev MD", | ||
"require": {}, | ||
"execute": { | ||
"command": "echo", | ||
"arguments": ["hello", "markdown"] | ||
} | ||
} | ||
} |
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,10 @@ | ||
{ | ||
"/tmp/phpgt/build/*.txt": { | ||
"name": "Example other mode TXT", | ||
"require": {}, | ||
"execute": { | ||
"command": "echo", | ||
"arguments": ["hello", "text", "other"] | ||
} | ||
} | ||
} |
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,38 @@ | ||
<?php | ||
namespace Gt\Build\Test; | ||
|
||
use Gt\Build\Configuration\Manifest; | ||
use Gt\Build\Configuration\TaskBlock; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class ManifestTest extends TestCase { | ||
public function testIterator():void { | ||
$jsonFile = "test/phpunit/Helper/Json/build.json"; | ||
$jsonObj = json_decode(file_get_contents($jsonFile), true); | ||
$sut = new Manifest($jsonFile); | ||
/** @var TaskBlock $taskBlock */ | ||
foreach($sut as $taskBlock) { | ||
$currentJsonObj = current($jsonObj); | ||
self::assertSame($currentJsonObj["name"], $taskBlock->getName()); | ||
self::assertSame($currentJsonObj["execute"]["arguments"], $taskBlock->getExecuteBlock()->arguments); | ||
next($jsonObj); | ||
} | ||
} | ||
|
||
public function testIterator_mode():void { | ||
$jsonFile = "test/phpunit/Helper/Json/build.json"; | ||
$jsonFileOther = "test/phpunit/Helper/Json/build.other-mode.json"; | ||
$jsonObjOther = json_decode(file_get_contents($jsonFileOther), true); | ||
$jsonObj = json_decode(file_get_contents($jsonFile), true); | ||
$jsonObj = array_merge($jsonObj, $jsonObjOther); | ||
|
||
$sut = new Manifest($jsonFile, "other-mode"); | ||
/** @var TaskBlock $taskBlock */ | ||
foreach($sut as $taskBlock) { | ||
$currentJsonObj = current($jsonObj); | ||
self::assertSame($currentJsonObj["name"], $taskBlock->getName()); | ||
self::assertSame($currentJsonObj["execute"]["arguments"], $taskBlock->getExecuteBlock()->arguments); | ||
next($jsonObj); | ||
} | ||
} | ||
} |