Skip to content

Commit

Permalink
Fix InitIdxFile::fromDeployRecipe
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzcris committed Sep 13, 2016
1 parent f5af651 commit 62e6fff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Idephix/Task/Builtin/InitIdxFile.php
Expand Up @@ -29,8 +29,8 @@ public static function fromDeployRecipe($writeTo = '.')
{
return new static(
$writeTo,
__DIR__ . '/../Cookbook/Deploy/idxfile.php',
__DIR__ . '/../Cookbook/Deploy/idxrc.php'
__DIR__ . '/../../Cookbook/Deploy/idxfile.php',
__DIR__ . '/../../Cookbook/Deploy/idxrc.php'
);
}

Expand Down
20 changes: 20 additions & 0 deletions tests/unit/Idephix/Task/InitIdxFileTest.php
Expand Up @@ -5,6 +5,7 @@
use org\bovigo\vfs\vfsStreamFile;
use org\bovigo\vfs\vfsStreamWrapper;
use Idephix\Task\Builtin\InitIdxFile;
use Symfony\Component\Console\Output\NullOutput;

class InitIdxFileTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -58,4 +59,23 @@ public function testInitWithExistingIdxFile()
$initIdxFile->setIdephix($idx);
$initIdxFile->initFile();
}

public function testInitFromDeployRecipe()
{
$idx = $this->getMockBuilder('\Idephix\Idephix')
->disableOriginalConstructor()
->getMock();

$idx->output = new NullOutput();
$initIdxFile = InitIdxFile::fromDeployRecipe('vfs://root');
$initIdxFile->setIdephix($idx);
$initIdxFile->initFile();

$this->assertTrue(file_exists('vfs://root/idxfile.php'));
$this->assertTrue(file_exists('vfs://root/idxrc.php'));

$this->assertEquals(file_get_contents(__DIR__ . '/../../../../src/Idephix/Cookbook/Deploy/idxfile.php'), file_get_contents('vfs://root/idxfile.php') );
$this->assertEquals(file_get_contents(__DIR__ . '/../../../../src/Idephix/Cookbook/Deploy/idxrc.php'), file_get_contents('vfs://root/idxrc.php') );
}

}

0 comments on commit 62e6fff

Please sign in to comment.