Skip to content

Commit

Permalink
Merge pull request #331 from matslindh/windows-tests-fix
Browse files Browse the repository at this point in the history
Fix GeneratePrivateKeyTest and FileSystemTest under Windows
  • Loading branch information
rexxars committed May 28, 2015
2 parents 1828d75 + 568ff06 commit 010892a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testCanGenerateAPrivateKey() {
$commandTester = new CommandTester($this->command);
$commandTester->execute(array('command' => $this->command->getName()));

$this->assertRegExp('/^[a-f0-9]{64}$/', $commandTester->getDisplay());
$this->assertRegExp('/^[a-f0-9]{64}$/', trim($commandTester->getDisplay()));
}

/**
Expand Down
14 changes: 11 additions & 3 deletions tests/phpunit/ImboUnitTest/Storage/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,26 @@ public function testStore() {
* @covers Imbo\Storage\Filesystem::getImagePath
*/
public function testGetImagePath() {
$driver = new Filesystem(array('dataDir' => '/tmp'));
$driver = new Filesystem(array('dataDir' => DIRECTORY_SEPARATOR . 'tmp'));

$reflection = new \ReflectionClass($driver);
$method = $reflection->getMethod('getImagePath');
$method->setAccessible(true);

$expectedFullPath = '/tmp/5/9/6/59632bc7a908b9cd47a35d03fc992aa7/9/6/d/96d08a5943ebf1c5635a2995c9408cdd.png';
$expectedDirPath = dirname($expectedFullPath);

if (DIRECTORY_SEPARATOR != '/') {
$expectedFullPath = str_replace('/', DIRECTORY_SEPARATOR, $expectedFullPath);
$expectedDirPath = str_replace('/', DIRECTORY_SEPARATOR, $expectedDirPath);
}

$this->assertSame(
'/tmp/5/9/6/59632bc7a908b9cd47a35d03fc992aa7/9/6/d/96d08a5943ebf1c5635a2995c9408cdd.png',
$expectedFullPath,
$method->invoke($driver, $this->publicKey, $this->imageIdentifier)
);
$this->assertSame(
'/tmp/5/9/6/59632bc7a908b9cd47a35d03fc992aa7/9/6/d',
$expectedDirPath,
$method->invoke($driver, $this->publicKey, $this->imageIdentifier, false)
);
}
Expand Down

0 comments on commit 010892a

Please sign in to comment.