Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix bug with missed config file in DI #15

Merged
merged 3 commits into from

2 participants

@cursedcoder
Owner

No description provided.

@torchello torchello commented on the diff
DependencyInjection/KnpLastTweetsExtension.php
@@ -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');

CS -- no spaces required

@cursedcoder Owner

it's not CS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@torchello torchello merged commit 310ede4 into KnpLabs:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  DependencyInjection/KnpLastTweetsExtension.php
@@ -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');

CS -- no spaces required

@cursedcoder Owner

it's not CS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
$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');
View
22 Tests/DependencyInjection/KnpLastTweetsExtensionTest.php
@@ -10,6 +10,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
+ */
public function shouldWorkWithArray()
{
$extension = $this->getExtensionMock();
Something went wrong with that request. Please try again.