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