コード例 #1
0
 public function testGetInstance()
 {
     TwitterOAuth::setConfig(realpath(__DIR__ . '/ExampleConfig.yaml'));
     Request::getInstance()->setCurrentUrl('http://admin.w3.com/batman-is-better-than-superman/?batman=one&superman=two');
     // other tests might change the library, which can cause this test to fail
     Bridge::setLibrary('\\Webiny\\Component\\TwitterOAuth\\Bridge\\League\\TwitterOAuth');
     $instance = TwitterOAuthLoader::getInstance('MyTwitterApp');
     $this->assertInstanceOf('\\Webiny\\Component\\TwitterOAuth\\TwitterOAuth', $instance);
 }
コード例 #2
0
ファイル: TwitterOAuthTest.php プロジェクト: Webiny/Framework
 public function dataProvider()
 {
     TwitterOAuth::setConfig(__DIR__ . '/ExampleConfig.yaml');
     $config = TwitterOAuth::getConfig();
     // create bridge
     $bridge = new \Webiny\Component\TwitterOAuth\Bridge\League\TwitterOAuth($config->get('MyTwitterApp.ClientId'), $config->get('MyTwitterApp.ClientSecret'), '/');
     // replace the \TwitterOAuth instance with mock
     $bridge = new TwitterOAuthMock($config->get('MyTwitterApp.ClientId'), $config->get('MyTwitterApp.ClientSecret'), '/');
     //$bridge->setDriverInstance($mock);
     // create TwitterOAuth instance
     $instance = new TwitterOAuth($bridge);
     return [[$instance]];
 }