/src/Joomla/Twitter/Tests/ListsTest.php
PHP | 2335 lines | 1562 code | 315 blank | 458 comment | 80 complexity | 3ecffc6e759f3dffcd8f987707fe753c MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- <?php
- /**
- * @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
- * @license GNU General Public License version 2 or later; see LICENSE
- */
- namespace Joomla\Twitter\Tests;
- use Joomla\Twitter\Lists;
- use \DomainException;
- use \RuntimeException;
- use \stdClass;
- require_once __DIR__ . '/case/TwitterTestCase.php';
- /**
- * Test class for Twitter Lists.
- *
- * @since 1.0
- */
- class ListsTest extends TwitterTestCase
- {
- /**
- * @var string Sample JSON error message.
- * @since 12.3
- */
- protected $errorString = '{"error":"Generic error"}';
- /**
- * @var string Sample JSON string.
- * @since 1.0
- */
- protected $rateLimit = '{"resources": {"lists": {
- "/lists/list": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/statuses": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/subscribers": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/subscribers/create": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/members/show": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/subscribers/show": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/subscribers/destroy": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/members/create_all": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/members": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/show": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/subscriptions": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/update": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/create": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"},
- "/lists/destroy": {"remaining":15, "reset":"Mon Jun 25 17:20:53 +0000 2012"}
- }}}';
- /**
- * Sets up the fixture, for example, opens a network connection.
- * This method is called before a test is executed.
- *
- * @access protected
- *
- * @return void
- */
- protected function setUp()
- {
- parent::setUp();
- $this->object = new Lists($this->options, $this->client, $this->oauth);
- }
- /**
- * Provides test data for request format detection.
- *
- * @return array
- *
- * @since 1.0
- */
- public function seedUser()
- {
- // User ID or screen name
- return array(
- array(234654235457),
- array('testUser'),
- array(null)
- );
- }
- /**
- * Tests the getAllLists method
- *
- * @param mixed $user Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedUser
- */
- public function testGetLists($user)
- {
- $reverse = true;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($user))
- {
- $data['user_id'] = $user;
- }
- elseif (is_string($user))
- {
- $data['screen_name'] = $user;
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getLists($user);
- }
- $data['reverse'] = true;
- $path = $this->object->fetchUrl('/lists/list.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->getLists($user, $reverse),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the getAllLists method - failure
- *
- * @param mixed $user Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedUser
- * @expectedException DomainException
- */
- public function testGetListsFailure($user)
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($user))
- {
- $data['user_id'] = $user;
- }
- elseif (is_string($user))
- {
- $data['screen_name'] = $user;
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getLists($user);
- }
- $path = $this->object->fetchUrl('/lists/list.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->object->getLists($user);
- }
- /**
- * Provides test data for request format detection.
- *
- * @return array
- *
- * @since 1.0
- */
- public function seedListStatuses()
- {
- // List ID or slug and owner
- return array(
- array(234654235457, null),
- array('test-list', 'testUser'),
- array('test-list', 12345),
- array('test-list', null),
- array(null, null)
- );
- }
- /**
- * Tests the getListStatuses method
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- */
- public function testGetStatuses($list, $owner)
- {
- $since_id = 12345;
- $max_id = 54321;
- $count = 10;
- $entities = true;
- $include_rts = true;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->getStatuses($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getStatuses($list, $owner);
- }
- $data['since_id'] = $since_id;
- $data['max_id'] = $max_id;
- $data['count'] = $count;
- $data['include_entities'] = $entities;
- $data['include_rts'] = $include_rts;
- $path = $this->object->fetchUrl('/lists/statuses.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->getStatuses($list, $owner, $since_id, $max_id, $count, $entities, $include_rts),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the getListStatuses method - failure
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- * @expectedException DomainException
- */
- public function testGetStatusesFailure($list, $owner)
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->getStatuses($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getStatuses($list, $owner);
- }
- $path = $this->object->fetchUrl('/lists/statuses.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->object->getStatuses($list, $owner);
- }
- /**
- * Tests the getListSubscribers method
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- */
- public function testGetSubscribers($list, $owner)
- {
- $cursor = 1234;
- $entities = true;
- $skip_status = true;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->getSubscribers($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getSubscribers($list, $owner);
- }
- $data['cursor'] = $cursor;
- $data['include_entities'] = $entities;
- $data['skip_status'] = $skip_status;
- $path = $this->object->fetchUrl('/lists/subscribers.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->getSubscribers($list, $owner, $cursor, $entities, $skip_status),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the getListSubscribers method - failure
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- * @expectedException DomainException
- */
- public function testGetSubscribersFailure($list, $owner)
- {
- $cursor = 1234;
- $entities = true;
- $skip_status = true;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->getSubscribers($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getSubscribers($list, $owner);
- }
- $data['cursor'] = $cursor;
- $data['include_entities'] = $entities;
- $data['skip_status'] = $skip_status;
- $path = $this->object->fetchUrl('/lists/subscribers.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->object->getSubscribers($list, $owner, $cursor, $entities, $skip_status);
- }
- /**
- * Provides test data for request format detection.
- *
- * @return array
- *
- * @since 1.0
- */
- public function seedMembers()
- {
- // List, User ID, screen name and owner.
- return array(
- array(234654235457, null, '234654235457', null),
- array('test-list', null, 'userTest', 'testUser'),
- array('test-list', '234654235457', null, '56165105642'),
- array('test-list', 'testUser', null, null),
- array('test-list', null, null, 'testUser'),
- array('test-list', 'testUser', '234654235457', 'userTest'),
- array(null, null, null, null)
- );
- }
- /**
- * Tests the deleteListMembers method
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param string $user_id A comma separated list of user IDs, up to 100 are allowed in a single request.
- * @param string $screen_name A comma separated list of screen names, up to 100 are allowed in a single request.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name of the owner.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedMembers
- */
- public function testDeleteMembers($list, $user_id, $screen_name, $owner)
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->deleteMembers($list, $user_id, $screen_name, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->deleteMembers($list, $user_id, $screen_name, $owner);
- }
- if ($user_id)
- {
- $data['user_id'] = $user_id;
- }
- if ($screen_name)
- {
- $data['screen_name'] = $screen_name;
- }
- if ($user_id == null && $screen_name == null)
- {
- $this->setExpectedException('RuntimeException');
- $this->object->deleteMembers($list, $user_id, $screen_name, $owner);
- }
- $path = $this->object->fetchUrl('/lists/members/destroy_all.json');
- $this->client->expects($this->once())
- ->method('post')
- ->with($path, $data)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->deleteMembers($list, $user_id, $screen_name, $owner),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the deleteListMembers method - failure
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param string $user_id A comma separated list of user IDs, up to 100 are allowed in a single request.
- * @param string $screen_name A comma separated list of screen names, up to 100 are allowed in a single request.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name of the owner.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedMembers
- * @expectedException DomainException
- */
- public function testDeleteMembersFailure($list, $user_id, $screen_name, $owner)
- {
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->deleteMembers($list, $user_id, $screen_name, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->deleteMembers($list, $user_id, $screen_name, $owner);
- }
- if ($user_id)
- {
- $data['user_id'] = $user_id;
- }
- if ($screen_name)
- {
- $data['screen_name'] = $screen_name;
- }
- if ($user_id == null && $screen_name == null)
- {
- $this->setExpectedException('RuntimeException');
- $this->object->deleteMembers($list, $user_id, $screen_name, $owner);
- }
- $path = $this->object->fetchUrl('/lists/members/destroy_all.json');
- $this->client->expects($this->once())
- ->method('post')
- ->with($path, $data)
- ->will($this->returnValue($returnData));
- $this->object->deleteMembers($list, $user_id, $screen_name, $owner);
- }
- /**
- * Tests the subscribe method
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- */
- public function testSubscribe($list, $owner)
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->subscribe($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->subscribe($list, $owner);
- }
- $path = $this->object->fetchUrl('/lists/subscribers/create.json');
- $this->client->expects($this->at(1))
- ->method('post')
- ->with($path, $data)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->subscribe($list, $owner),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the subscribe method - failure
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- * @expectedException DomainException
- */
- public function testSubscribeFailure($list, $owner)
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->subscribe($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->subscribe($list, $owner);
- }
- $path = $this->object->fetchUrl('/lists/subscribers/create.json');
- $this->client->expects($this->at(1))
- ->method('post')
- ->with($path, $data)
- ->will($this->returnValue($returnData));
- $this->object->subscribe($list, $owner);
- }
- /**
- * Provides test data for request format detection.
- *
- * @return array
- *
- * @since 1.0
- */
- public function seedListUserOwner()
- {
- // List, User and Owner.
- return array(
- array(234654235457, '234654235457', null),
- array('test-list', 'userTest', 'testUser'),
- array('test-list', '234654235457', '56165105642'),
- array('test-list', 'testUser', null),
- array('test-list', null, 'testUser'),
- array(null, null, null)
- );
- }
- /**
- * Tests the isListMember method
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $user Either an integer containing the user ID or a string containing the screen name of the user to remove.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name of the owner.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListUserOwner
- */
- public function testIsMember($list, $user, $owner)
- {
- $entities = true;
- $skip_status = true;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->isMember($list, $user, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->isMember($list, $user, $owner);
- }
- if (is_numeric($user))
- {
- $data['user_id'] = $user;
- }
- elseif (is_string($user))
- {
- $data['screen_name'] = $user;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->isMember($list, $user, $owner);
- }
- $data['include_entities'] = $entities;
- $data['skip_status'] = $skip_status;
- $path = $this->object->fetchUrl('/lists/members/show.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->isMember($list, $user, $owner, $entities, $skip_status),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the isListMember method - failure
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $user Either an integer containing the user ID or a string containing the screen name of the user to remove.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name of the owner.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListUserOwner
- * @expectedException DomainException
- */
- public function testIsMemberFailure($list, $user, $owner)
- {
- $entities = true;
- $skip_status = true;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->isMember($list, $user, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->isMember($list, $user, $owner);
- }
- if (is_numeric($user))
- {
- $data['user_id'] = $user;
- }
- elseif (is_string($user))
- {
- $data['screen_name'] = $user;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->isMember($list, $user, $owner);
- }
- $data['include_entities'] = $entities;
- $data['skip_status'] = $skip_status;
- $path = $this->object->fetchUrl('/lists/members/show.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->object->isMember($list, $user, $owner, $entities, $skip_status);
- }
- /**
- * Tests the isListSubscriber method
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $user Either an integer containing the user ID or a string containing the screen name of the user to remove.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name of the owner.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListUserOwner
- */
- public function testIsSubscriber($list, $user, $owner)
- {
- $entities = true;
- $skip_status = true;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->isSubscriber($list, $user, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->isSubscriber($list, $user, $owner);
- }
- if (is_numeric($user))
- {
- $data['user_id'] = $user;
- }
- elseif (is_string($user))
- {
- $data['screen_name'] = $user;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->isSubscriber($list, $user, $owner);
- }
- $data['include_entities'] = $entities;
- $data['skip_status'] = $skip_status;
- $path = $this->object->fetchUrl('/lists/subscribers/show.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->isSubscriber($list, $user, $owner, $entities, $skip_status),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the isListSubscriber method - failure
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $user Either an integer containing the user ID or a string containing the screen name of the user to remove.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name of the owner.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListUserOwner
- * @expectedException DomainException
- */
- public function testIsSubscriberFailure($list, $user, $owner)
- {
- $entities = true;
- $skip_status = true;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->isSubscriber($list, $user, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->isSubscriber($list, $user, $owner);
- }
- if (is_numeric($user))
- {
- $data['user_id'] = $user;
- }
- elseif (is_string($user))
- {
- $data['screen_name'] = $user;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->isSubscriber($list, $user, $owner);
- }
- $data['include_entities'] = $entities;
- $data['skip_status'] = $skip_status;
- $path = $this->object->fetchUrl('/lists/subscribers/show.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->object->isSubscriber($list, $user, $owner, $entities, $skip_status);
- }
- /**
- * Tests the unsubscribe method
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- */
- public function testUnsubscribe($list, $owner)
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->unsubscribe($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->unsubscribe($list, $owner);
- }
- $path = $this->object->fetchUrl('/lists/subscribers/destroy.json');
- $this->client->expects($this->at(1))
- ->method('post')
- ->with($path, $data)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->unsubscribe($list, $owner),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the unsubscribe method - failure
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- * @expectedException DomainException
- */
- public function testUnsubscribeFailure($list, $owner)
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->unsubscribe($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->unsubscribe($list, $owner);
- }
- $path = $this->object->fetchUrl('/lists/subscribers/destroy.json');
- $this->client->expects($this->at(1))
- ->method('post')
- ->with($path, $data)
- ->will($this->returnValue($returnData));
- $this->object->unsubscribe($list, $owner);
- }
- /**
- * Tests the addListMembers method
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param string $user_id A comma separated list of user IDs, up to 100 are allowed in a single request.
- * @param string $screen_name A comma separated list of screen names, up to 100 are allowed in a single request.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedMembers
- */
- public function testAddMembers($list, $user_id, $screen_name, $owner)
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->addMembers($list, $user_id, $screen_name, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->addMembers($list, $user_id, $screen_name, $owner);
- }
- if ($user_id)
- {
- $data['user_id'] = $user_id;
- }
- if ($screen_name)
- {
- $data['screen_name'] = $screen_name;
- }
- if ($user_id == null && $screen_name == null)
- {
- $this->setExpectedException('RuntimeException');
- $this->object->addMembers($list, $user_id, $screen_name, $owner);
- }
- $path = $this->object->fetchUrl('/lists/members/create_all.json');
- $this->client->expects($this->at(1))
- ->method('post')
- ->with($path, $data)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->addMembers($list, $user_id, $screen_name, $owner),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the addListMembers method - failure
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param string $user_id A comma separated list of user IDs, up to 100 are allowed in a single request.
- * @param string $screen_name A comma separated list of screen names, up to 100 are allowed in a single request.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedMembers
- * @expectedException DomainException
- */
- public function testAddMembersFailure($list, $user_id, $screen_name, $owner)
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->addMembers($list, $user_id, $screen_name, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->addMembers($list, $user_id, $screen_name, $owner);
- }
- if ($user_id)
- {
- $data['user_id'] = $user_id;
- }
- if ($screen_name)
- {
- $data['screen_name'] = $screen_name;
- }
- if ($user_id == null && $screen_name == null)
- {
- $this->setExpectedException('RuntimeException');
- $this->object->addMembers($list, $user_id, $screen_name, $owner);
- }
- $path = $this->object->fetchUrl('/lists/members/create_all.json');
- $this->client->expects($this->at(1))
- ->method('post')
- ->with($path, $data)
- ->will($this->returnValue($returnData));
- $this->object->addMembers($list, $user_id, $screen_name, $owner);
- }
- /**
- * Tests the getListMembers method
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- */
- public function testGetMembers($list, $owner)
- {
- $entities = true;
- $skip_status = true;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->getMembers($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getMembers($list, $owner);
- }
- $data['include_entities'] = $entities;
- $data['skip_status'] = $skip_status;
- $path = $this->object->fetchUrl('/lists/members.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->getMembers($list, $owner, $entities, $skip_status),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the getListMembers method - failure
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- * @expectedException DomainException
- */
- public function testGetMembersFailure($list, $owner)
- {
- $entities = true;
- $skip_status = true;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->getMembers($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getMembers($list, $owner);
- }
- $data['include_entities'] = $entities;
- $data['skip_status'] = $skip_status;
- $path = $this->object->fetchUrl('/lists/members.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->object->getMembers($list, $owner, $entities, $skip_status);
- }
- /**
- * Tests the getListById method
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- */
- public function testGetListById($list, $owner)
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->getListById($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getListById($list, $owner);
- }
- $path = $this->object->fetchUrl('/lists/show.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->getListById($list, $owner),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the getListById method - failure
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- * @expectedException DomainException
- */
- public function testGetListByIdFailure($list, $owner)
- {
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->getListById($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getListById($list, $owner);
- }
- $path = $this->object->fetchUrl('/lists/show.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->object->getListById($list, $owner);
- }
- /**
- * Tests the getSubscriptions method
- *
- * @param mixed $user Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedUser
- */
- public function testGetSubscriptions($user)
- {
- $count = 10;
- $cursor = 1234;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($user))
- {
- $data['user_id'] = $user;
- }
- elseif (is_string($user))
- {
- $data['screen_name'] = $user;
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getSubscriptions($user);
- }
- $data['count'] = $count;
- $data['cursor'] = $cursor;
- $path = $this->object->fetchUrl('/lists/subscriptions.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->assertThat(
- $this->object->getSubscriptions($user, $count, $cursor),
- $this->equalTo(json_decode($this->sampleString))
- );
- }
- /**
- * Tests the getSubscriptions method - failure
- *
- * @param mixed $user Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedUser
- * @expectedException DomainException
- */
- public function testGetSubscriptionsFailure($user)
- {
- $count = 10;
- $cursor = 1234;
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 500;
- $returnData->body = $this->errorString;
- // Set request parameters.
- if (is_numeric($user))
- {
- $data['user_id'] = $user;
- }
- elseif (is_string($user))
- {
- $data['screen_name'] = $user;
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->getSubscriptions($user);
- }
- $data['count'] = $count;
- $data['cursor'] = $cursor;
- $path = $this->object->fetchUrl('/lists/subscriptions.json', $data);
- $this->client->expects($this->at(1))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $this->object->getSubscriptions($user, $count, $cursor);
- }
- /**
- * Tests the updateList method
- *
- * @param mixed $list Either an integer containing the list ID or a string containing the list slug.
- * @param mixed $owner Either an integer containing the user ID or a string containing the screen name.
- *
- * @return void
- *
- * @since 1.0
- * @dataProvider seedListStatuses
- */
- public function testUpdate($list, $owner)
- {
- $name = 'test list';
- $mode = 'private';
- $description = 'this is a description';
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->rateLimit;
- $path = $this->object->fetchUrl('/application/rate_limit_status.json', array("resources" => "lists"));
- $this->client->expects($this->at(0))
- ->method('get')
- ->with($path)
- ->will($this->returnValue($returnData));
- $returnData = new stdClass;
- $returnData->code = 200;
- $returnData->body = $this->sampleString;
- // Set request parameters.
- if (is_numeric($list))
- {
- $data['list_id'] = $list;
- }
- elseif (is_string($list))
- {
- $data['slug'] = $list;
- if (is_numeric($owner))
- {
- $data['owner_id'] = $owner;
- }
- elseif (is_string($owner))
- {
- $data['owner_screen_name'] = $owner;
- }
- else
- {
- // We don't have a valid entry
- $this->setExpectedException('RuntimeException');
- $this->object->update($list, $owner);
- }
- }
- else
- {
- $this->setExpectedException('RuntimeException');
- $this->object->update($list, $owner);
- }
- $data['name'] = $name;
- $data['mode'] = $mode;
- $data['description'] = $description;
- $path = $this->object->fetchUrl('/lists/update.json');
- $this->client->expects($this->at(1))
- ->method('post')
- ->with($p…
Large files files are truncated, but you can click here to view the full file