-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from kschroeder/develop
A bunch o'f stuff
- Loading branch information
Showing
9 changed files
with
166 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
namespace Magium\Configuration\Tests\Command; | ||
|
||
use Magium\Configuration\Config\Builder; | ||
use Magium\Configuration\Config\BuilderFactory; | ||
use Magium\Configuration\Config\BuilderFactoryInterface; | ||
use Magium\Configuration\Config\Config; | ||
use Magium\Configuration\Config\Storage\StorageInterface; | ||
use Magium\Configuration\Console\Command\ConfigurationSet; | ||
use Magium\Configuration\Console\Command\ContextList; | ||
use Magium\Configuration\Console\Command\UnconfiguredPathException; | ||
use Magium\Configuration\File\Context\AbstractContextConfigurationFile; | ||
use Magium\Configuration\MagiumConfigurationFactory; | ||
use Magium\Configuration\MagiumConfigurationFactoryInterface; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class ContextListTest extends TestCase | ||
{ | ||
|
||
public function testConfiguration() | ||
{ | ||
$command = new ContextList(); | ||
$name = $command->getName(); | ||
self::assertEquals(ContextList::COMMAND, $name); | ||
} | ||
|
||
public function testIndentationIsCorrect() | ||
{ | ||
self::assertEquals(' ', ContextList::TAB); | ||
} | ||
|
||
public function testGetFormat() | ||
{ | ||
|
||
$config = $this->createMock(AbstractContextConfigurationFile::class); | ||
$config->expects(self::once())->method('toXml')->willReturn( | ||
new \SimpleXMLElement(<<<XML | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<defaultContext xmlns="http://www.magiumlib.com/ConfigurationContext"> | ||
<context id="test" title="Test"> | ||
<context title="SubTest" id="subtest" /> | ||
</context> | ||
<context id="base"/> | ||
</defaultContext> | ||
XML | ||
) | ||
); | ||
$factory = $this->createMock(MagiumConfigurationFactoryInterface::class); | ||
$factory->expects(self::once())->method('getContextFile')->willReturn($config); | ||
$contextList = new ContextList(); | ||
$contextList->setConfigurationFactory($factory); | ||
|
||
$output = $this->createMock(OutputInterface::class); | ||
$expected = [ | ||
'default (Default)', | ||
ContextList::TAB . 'test (Test)', | ||
ContextList::TAB . ContextList::TAB . 'subtest (SubTest)', | ||
ContextList::TAB . 'base', | ||
]; | ||
$output->expects(self::any())->method('writeln')->willReturnCallback(function($param) use (&$expected) { | ||
$key = array_search($param, $expected); | ||
if ($key !== false) { | ||
unset($expected[$key]); | ||
} | ||
}); | ||
|
||
$contextList->run($this->createMock(InputInterface::class), $output); | ||
|
||
self::assertCount(0, $expected); | ||
} | ||
|
||
|
||
} |
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