setLibrary() public static method

Change the default library used for the driver.
public static setLibrary ( string $pathToClass )
$pathToClass string Path to the new bridge class. The class must implement \Webiny\Component\TwitterOAuth\Bridge\TwitterOAuthInterface.
コード例 #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
 /**
  * @expectedException \Webiny\Component\TwitterOAuth\Bridge\TwitterOAuthException
  */
 public function testGetInstanceException()
 {
     TwitterOAuth::setLibrary('\\Webiny\\Component\\TwitterOAuth\\Tests\\Mocks\\FakeBridgeMock');
     TwitterOAuth::getInstance('client', 'secret', 'redirect');
 }