本文整理汇总了PHP中AppModel::getTwitterSource方法的典型用法代码示例。如果您正苦于以下问题:PHP AppModel::getTwitterSource方法的具体用法?PHP AppModel::getTwitterSource怎么用?PHP AppModel::getTwitterSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppModel
的用法示例。
在下文中一共展示了AppModel::getTwitterSource方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTwitterSetTokenById
function testTwitterSetTokenById()
{
$this->loadFixtures('UserToken');
$this->TestModel = ClassRegistry::init('UserToken');
$this->TestModel->Behaviors->attach('TwitterKit.Twitter');
$result = $this->TestModel->twitterSetTokenById();
$ds = $this->TestModel->getTwitterSource();
$this->assertFalse($result);
// --
$this->TestModel->Behaviors->Twitter->DataSource->reset();
$result = $this->TestModel->twitterSetTokenById(1);
$ds = $this->TestModel->getTwitterSource();
$this->assertTrue($result);
$this->assertEqual('oauth_token1', $ds->oauth_token);
$this->assertEqual('oauth_token_secret1', $ds->oauth_token_secret);
// --
$this->TestModel->id = 2;
$this->TestModel->Behaviors->Twitter->DataSource->reset();
$result = $this->TestModel->twitterSetTokenById();
$ds = $this->TestModel->getTwitterSource();
$this->assertTrue($result);
$this->assertEqual('oauth_token2', $ds->oauth_token);
$this->assertEqual('oauth_token_secret2', $ds->oauth_token_secret);
// --
$this->TestModel->Behaviors->Twitter->DataSource->reset();
$this->TestModel->Behaviors->detach('TwitterKit.Twitter');
$this->TestModel->Behaviors->attach('TwitterKit.Twitter', array('fields' => array('oauth_token' => 'access_token', 'oauth_token_secret' => 'access_token_secret')));
$result = $this->TestModel->twitterSetTokenById(1);
$ds = $this->TestModel->getTwitterSource();
$this->assertTrue($result);
$this->assertEqual('access_token1', $ds->oauth_token);
$this->assertEqual('access_token_secret1', $ds->oauth_token_secret);
// --
$this->TestModel->Behaviors->Twitter->DataSource->reset();
$result = $this->TestModel->twitterSetTokenById(3);
$ds = $this->TestModel->getTwitterSource();
$this->assertFalse($result);
$this->assertEqual('', $ds->oauth_token);
$this->assertEqual('', $ds->oauth_token_secret);
// --
$this->TestModel->Behaviors->Twitter->DataSource->reset();
$result = $this->TestModel->twitterSetTokenById(4);
$ds = $this->TestModel->getTwitterSource();
$this->assertFalse($result);
}