Fix bug with missed config file in DI #15

Merged
merged 3 commits into from May 25, 2012
Jump to file or symbol
Failed to load files and symbols.
+24 −0
Split
@@ -67,6 +67,8 @@ public function load(array $configs, ContainerBuilder $container)
throw new \InvalidArgumentException('Invalid API driver specified ('.$driverOptions['method'].'), available are: "oauth", "api"');
}
+ $loader->load($driverOptions['method'] . '.yml');
@torchello

torchello May 25, 2012

Contributor

CS -- no spaces required

@cursedcoder

cursedcoder May 25, 2012

Collaborator

it's not CS

+
$container->setAlias('knp_last_tweets.last_tweets_additional_fetcher', 'knp_last_tweets.last_tweets_fetcher.' . $driverOptions['method']);
} else {
$container->setAlias('knp_last_tweets.last_tweets_additional_fetcher', 'knp_last_tweets.last_tweets_fetcher.api');
@@ -7,6 +7,28 @@
class KnpLastTweetsExtensionTest extends \PHPUnit_Framework_TestCase
{
+ /**
+ * @test
+ */
+ public function shouldSetAliases()
+ {
+ $extension = $this->getExtensionMock();
+
+ $extension->expects($this->once())
+ ->method('oauthExists')
+ ->will($this->returnValue(true));
+
+ $config = $this->getConfig('zend_oauth');
+ $container = new ContainerBuilder();
+
+ $extension->load($config, $container);
+
+ $this->assertTrue($container->hasAlias('knp_last_tweets.last_tweets_fetcher'));
+ $this->assertTrue($container->hasDefinition('knp_last_tweets.last_tweets_fetcher.oauth'));
+ $this->assertTrue($container->hasDefinition('knp_last_tweets.last_tweets_fetcher.zend_cache'));
+ $this->assertTrue($container->hasAlias('knp_last_tweets.last_tweets_additional_fetcher'));
+ }
+
/**
* @test
*/