[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 use \Mockery as m; 4 5 class ConnectAppsTest extends PHPUnit_Framework_TestCase { 6 7 function testUpdateWithArray() { 8 $http = m::mock(new Services_Twilio_TinyHttp); 9 $http->shouldReceive('get')->once() 10 ->with('/2010-04-01/Accounts/AC123/ConnectApps/CN123.json') 11 ->andReturn(array(200, array('Content-Type' => 'application/json'), 12 json_encode(array('friendly_name' => 'foo')) 13 )); 14 $http->shouldReceive('post')->once() 15 ->with('/2010-04-01/Accounts/AC123/ConnectApps/CN123.json', 16 array('Content-Type' => 'application/x-www-form-urlencoded'), 17 'FriendlyName=Bar') 18 ->andReturn(array(200, array('Content-Type' => 'application/json'), 19 json_encode(array('friendly_name' => 'Bar')) 20 )); 21 $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 22 $cn = $client->account->connect_apps->get('CN123'); 23 $this->assertEquals('foo', $cn->friendly_name); 24 $cn->update(array('FriendlyName' => 'Bar')); 25 $this->assertEquals('Bar', $cn->friendly_name); 26 } 27 28 function testUpdateWithOneParam() 29 { 30 $http = m::mock(new Services_Twilio_TinyHttp); 31 $http->shouldReceive('get')->once() 32 ->with('/2010-04-01/Accounts/AC123/ConnectApps/CN123.json') 33 ->andReturn(array(200, array('Content-Type' => 'application/json'), 34 json_encode(array('friendly_name' => 'foo')) 35 )); 36 $http->shouldReceive('post')->once() 37 ->with('/2010-04-01/Accounts/AC123/ConnectApps/CN123.json', 38 array('Content-Type' => 'application/x-www-form-urlencoded'), 39 'FriendlyName=Bar') 40 ->andReturn(array(200, array('Content-Type' => 'application/json'), 41 json_encode(array('friendly_name' => 'Bar')) 42 )); 43 $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); 44 $cn = $client->account->connect_apps->get('CN123'); 45 $this->assertEquals('foo', $cn->friendly_name); 46 $cn->update('FriendlyName', 'Bar'); 47 $this->assertEquals('Bar', $cn->friendly_name); 48 } 49 50 function tearDown() 51 { 52 m::close(); 53 } 54 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |