Skip to content

Commit

Permalink
Merge branch 'master' of github.com:DivineOmega/php-hcl-parser
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineOmega committed Apr 10, 2018
2 parents 8d53540 + 5bf513c commit afdcc47
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/HCLParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ public function parse()
{
return json_decode($this->getJSONString());
}
}
}
4 changes: 2 additions & 2 deletions src/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static function installBinaries()
{
$binaryUrls = ['https://github.com/kvz/json2hcl/releases/download/v0.0.6/json2hcl_v0.0.6_linux_amd64'];

foreach($binaryUrls as $binaryUrl) {
foreach ($binaryUrls as $binaryUrl) {
$destination = __DIR__.'/../bin/'.basename($binaryUrl);

if (file_exists($destination)) {
Expand All @@ -19,4 +19,4 @@ public static function installBinaries()
chmod($destination, 0755);
}
}
}
}
2 changes: 1 addition & 1 deletion test.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@
}
}
*/
*/
3 changes: 1 addition & 2 deletions tests/Unit/BasicUsageTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use PHPUnit\Framework\TestCase;
use DivineOmega\HCLParser\HCLParser;
use PHPUnit\Framework\TestCase;

class BasicUsageTest extends TestCase
{
Expand All @@ -14,5 +14,4 @@ public function testBasicParsing()

$this->assertEquals($expected, $configObject);
}

}
11 changes: 5 additions & 6 deletions tests/Unit/InstallerTest.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

use PHPUnit\Framework\TestCase;
use DivineOmega\HCLParser\Installer;
use PHPUnit\Framework\TestCase;

class InstallerTest extends TestCase
{
public function testBinariesInstallation()
{
foreach(glob(__DIR__.'/../../bin/*') as $file) {
foreach (glob(__DIR__.'/../../bin/*') as $file) {
unlink($file);
}

// Check binaries install after deletion
Installer::installBinaries();
$this->checkBinariesAreInstalled();

// Check binaries remain installed if call is made a second time
Installer::installBinaries();
$this->checkBinariesAreInstalled();
Expand All @@ -24,15 +24,14 @@ private function checkBinariesAreInstalled()
{
$files = glob(__DIR__.'/../../bin/*');

array_walk($files, function(&$value) {
array_walk($files, function (&$value) {
$value = basename($value);
});

$expectedFiles = ['json2hcl_v0.0.6_linux_amd64'];

foreach($expectedFiles as $expectedFile) {
foreach ($expectedFiles as $expectedFile) {
$this->assertContains($expectedFile, $files);
}
}

}

0 comments on commit afdcc47

Please sign in to comment.