Skip to content

Commit

Permalink
CS
Browse files Browse the repository at this point in the history
  • Loading branch information
marc.weistroff committed Feb 8, 2012
1 parent b9be622 commit 23cde6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
17 changes: 9 additions & 8 deletions Tests/Command/WurstCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testWurstTypes()
$this->assertSame($expectedOutput, $this->commandTester->getDisplay());
}
}

public function testSides()
{
foreach ($this->sides as $side)
Expand All @@ -45,7 +45,7 @@ public function testSides()
$this->assertSame($expectedOutput, $this->commandTester->getDisplay());
}
}

public function testSidesWithAllWurstTypes()
{
foreach ($this->sides as $side)
Expand All @@ -65,27 +65,28 @@ public function testSidesWithAllWurstTypes()
}
}
}

private function getExpectedSideContentForGivenType($side, $givenType)
{
$content = $this->getExpectedWurstContent($givenType);
$content .= $this->getContentFromDirectoryAndFile($this->sideResourcesDirectory, $side);

return $content;
}

private function getExpectedWurstContent($wurst)
{
$content = $this->getContentFromDirectoryAndFile($this->wurstResourcesDirectory, $wurst);
$content .= PHP_EOL;

return $content;
}

private function getContentFromDirectoryAndFile($directory, $file)
{
$content = file_get_contents($directory.$file.'.txt');

return $content;
}
}

12 changes: 6 additions & 6 deletions Tests/Command/WurstCommandTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class WurstCommandTestCase extends \PHPUnit_Framework_TestCase
protected $commandTester;
protected $wurstTypes;
protected $sides;

public function __construct()
{
$resourceDirectory = $this->getResourceDirectory();
Expand All @@ -30,15 +30,15 @@ public function __construct()
$this->wurstTypes = $this->findFilenamesFromGivenDirectory($this->wurstResourcesDirectory);
$this->sides = $this->findFilenamesFromGivenDirectory($this->sideResourcesDirectory);
}

protected function getResourceDirectory()
{
$sourceDirectory = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;
$resourceDirectory = $sourceDirectory.'Resources'.DIRECTORY_SEPARATOR;

return $resourceDirectory;
}

protected function setCommand()
{
$mockedKernel = $this->getMock('Symfony\\Component\\HttpKernel\\Kernel', array(), array(), '', false);
Expand All @@ -47,7 +47,7 @@ protected function setCommand()

$this->command = $application->find('wurst:print');
}

protected function findFilenamesFromGivenDirectory($givenDirectory)
{
$foundFiles = Finder::create()
Expand All @@ -63,7 +63,7 @@ protected function findFilenamesFromGivenDirectory($givenDirectory)
foreach ($foundFiles as $foundFile) {
$filenames[] = basename($foundFile->getRelativePathName(), '.txt');
}

return $filenames;
}
}

0 comments on commit 23cde6e

Please sign in to comment.