| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 | <?phpclass ResponseTest extends PHPUnit_Framework_TestCase {	/**	 * Test the Response::make method.	 *	 * @group laravel	 */	public function testMakeMethodProperlySetsContent()	{		$response = Response::make('foo', 201, array('bar' => 'baz'));		$this->assertEquals('foo', $response->content);		$this->assertEquals(201, $response->status);		$this->assertEquals(array('bar' => 'baz'), $response->headers);	}	/**	 * Test the Response::view method.	 *	 * @group laravel	 */	public function testViewMethodSetsContentToView()	{		$response = Response::view('home.index', array('name' => 'Taylor'));		$this->assertEquals('home.index', $response->content->view);		$this->assertEquals('Taylor', $response->content->data['name']);	}	/**	 * Test the Response::error method.	 *	 * @group laravel	 */	public function testErrorMethodSetsContentToErrorView()	{		$response = Response::error('404', array('name' => 'Taylor'));		$this->assertEquals(404, $response->status);		$this->assertEquals('error.404', $response->content->view);		$this->assertEquals('Taylor', $response->content->data['name']);	}	/**	 * Test the Response::prepare method.	 *	 * @group laravel	 */	public function testPrepareMethodCreatesAResponseInstanceFromGivenValue()	{		$response = Response::prepare('Taylor');		$this->assertInstanceOf('Laravel\\Response', $response);		$this->assertEquals('Taylor', $response->content);		$response = Response::prepare(new Response('Taylor'));		$this->assertInstanceOf('Laravel\\Response', $response);		$this->assertEquals('Taylor', $response->content);	}	/**	 * Test the Response::message method.	 *	 * @group laravel	 */	public function testMessageReturnsStatusCodeMessage()	{		$this->assertEquals('OK', Response::make('')->message());	}	/**	 * Test the Response::header method.	 *	 * @group laravel	 */	public function testHeaderMethodSetsValueInHeaderArray()	{		$response = Response::make('')->header('foo', 'bar');		$this->assertEquals('bar', $response->headers['foo']);	}	/**	 * Test the Response::status method.	 *	 * @group laravel	 */	public function testStatusMethodSetsStatusCode()	{		$response = Response::make('')->status(404);		$this->assertEquals(404, $response->status);	}}
 |