Ejemplo n.º 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']);
 }
Ejemplo n.º 2
0
 public function tearDown()
 {
     Castle_RequestTransport::reset();
     Castle_RequestTransport::setResponse(204, '');
 }
Ejemplo n.º 3
0
 /**
  * @expectedException Castle_InvalidParametersError
  */
 public function testInvalidParametersRequest()
 {
     Castle_RequestTransport::setResponse(422);
     $req = new Castle_Request();
     $req->send('GET', '/users');
 }
Ejemplo n.º 4
0
 public function testTrack()
 {
     Castle_RequestTransport::setResponse(204, '');
     Castle::track(array('name' => '$login.failed'));
     $this->assertRequest('post', '/events');
 }
Ejemplo n.º 5
0
 /**
  * @expectedException Castle_InvalidParametersError
  */
 public function testInvalidParameters()
 {
     Castle_RequestTransport::setResponse(422);
     $this->request->send('GET', '/test');
 }
Ejemplo n.º 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');
 }
Ejemplo n.º 7
0
 public function testApprove()
 {
     Castle_RequestTransport::setResponse(200, '{}');
     Castle::authentications(1)->approve();
     $this->assertRequest('post', '/authentications/1/approve');
 }