Source of file TwitterAccountTest.php
Size: 1,404 Bytes - Last Modified: 2021-12-23T10:37:54+00:00
/var/www/docs.ssmods.com/process/src/tests/TwitterAccountTest.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 | <?php class TwitterAccountTest extends SapphireTest { public function testSetAccessToken() { /** * Should serialize the token and set it on the TwitterAccount. */ $token = ['token' => 'abc', 'secret' => '123']; $twitterAccount = new TwitterAccount(); $this->assertEquals(null, $twitterAccount->getField('AccessToken')); $twitterAccount->setAccessToken($token); $this->assertInternalType('string', $twitterAccount->getField('AccessToken')); } public function testGetAccessToken() { /** * Should return the unserialized token on TwitterAccount. */ $twitterAccount = new TwitterAccount([ 'AccessToken' => serialize(['token' => 'abc', 'secret' => '123']), ]); $this->assertInternalType('array', $twitterAccount->getAccessToken()); } public function testIsAuthorised() { /** * Should fail if an access token is not set. */ $twitterAccount = new TwitterAccount(); $this->assertFalse($twitterAccount->isAuthorised()); /** * Should pass if an access token is set. */ $twitterAccount = new TwitterAccount([ 'AccessToken' => serialize(['token' => 'abc', 'secret' => '123']), ]); $this->assertTrue($twitterAccount->isAuthorised()); } } |