4 require_once ('test/codebirdm.php');
7 * A Twitter library in PHP.
9 * @package codebird-test
10 * @author Jublo Solutions <support@jublo.net>
11 * @copyright 2010-2016 Jublo Solutions <support@jublo.net>
12 * @license https://opensource.org/licenses/GPL-3.0 GNU General Public License 3.0
13 * @link https://github.com/jublonet/codebird-php
19 * @package codebird-test
21 class Returnformat_Test extends \PHPUnit_Framework_TestCase
24 * Initialise Codebird class
26 * @return \Codebird\Codebird The Codebird class
28 protected function getCB()
30 Codebird::setConsumerKey('123', '456');
31 $cb = new CodebirdM();
32 $cb->setToken('234', '567');
38 * Tests array return format
40 public function testArrayFormat()
43 $cb->setReturnFormat(CODEBIRD_RETURNFORMAT_ARRAY);
44 $reply = $cb->users_show(['screen_name' => 'TwitterAPI']);
45 $this->assertTrue(is_array($reply));
49 * Tests object return format
51 public function testObjectFormat()
54 $cb->setReturnFormat(CODEBIRD_RETURNFORMAT_OBJECT);
55 $reply = $cb->users_show(['screen_name' => 'TwitterAPI']);
56 $this->assertInstanceOf('stdClass', $reply);
60 * Tests JSON return format
62 public function testJsonFormat()
65 $cb->setReturnFormat(CODEBIRD_RETURNFORMAT_JSON);
66 $reply = $cb->users_show(['screen_name' => 'TwitterAPI']);
67 $data = json_decode($reply);
68 $this->assertNotFalse($data);