示例#1
0
 /**
  * @dataProvider exampleSettings
  */
 public function testAccountPostRequest($settings)
 {
     Castle_RequestTransport::setResponse(200, $settings);
     $settings = new Castle_Account($settings);
     $settings->public_name = 'New name';
     $settings->save();
     $request = $this->assertRequest('post', '/account');
     $this->assertArrayHasKey('settings', $request['params']);
     $this->assertEquals('New name', $request['params']['settings']['public_name']);
 }
示例#2
0
 public function tearDown()
 {
     Castle_RequestTransport::reset();
     Castle_RequestTransport::setResponse(204, '');
 }
示例#3
0
 /**
  * @expectedException Castle_InvalidParametersError
  */
 public function testInvalidParametersRequest()
 {
     Castle_RequestTransport::setResponse(422);
     $req = new Castle_Request();
     $req->send('GET', '/users');
 }
示例#4
0
 public function testTrack()
 {
     Castle_RequestTransport::setResponse(204, '');
     Castle::track(array('name' => '$login.failed'));
     $this->assertRequest('post', '/events');
 }
示例#5
0
 /**
  * @expectedException Castle_InvalidParametersError
  */
 public function testInvalidParameters()
 {
     Castle_RequestTransport::setResponse(422);
     $this->request->send('GET', '/test');
 }
示例#6
0
 public function testNestedInstanceMethod()
 {
     Castle_RequestTransport::setResponse(200, array('id' => 1));
     $user = new TestUser(1234);
     $shoe = $user->shoes()->find(1);
     $shoe->walk('response');
     $this->assertRequest('post', '/users/1234/shoes/1/walk');
 }
示例#7
0
 public function testApprove()
 {
     Castle_RequestTransport::setResponse(200, '{}');
     Castle::authentications(1)->approve();
     $this->assertRequest('post', '/authentications/1/approve');
 }