コード例 #1
0
 public function testNormalResponseIsReturnedIfMethodIsMissing()
 {
     Request::shouldReceive('getContent')->andReturn(json_encode(['type' => 'foo.bar', 'id' => 'event-id']));
     $controller = new WebhookControllerTestStub();
     $response = $controller->handleWebhook();
     $this->assertEquals(200, $response->getStatusCode());
 }
コード例 #2
0
ファイル: TableTest.php プロジェクト: Cyber-Duck/Datatable
 public function testRender()
 {
     Request::shouldReceive('url')->once()->andReturn('fooBar');
     View::shouldReceive('make')->once()->with('datatable::template', array('options' => array('sAjaxSource' => 'fooBar', 'bServerSide' => true, 'sPaginationType' => 'full_numbers', 'bProcessing' => false), 'callbacks' => array(), 'values' => array(), 'data' => array(), 'columns' => array(1 => 'foo'), 'noScript' => false, 'class' => $this->table->getClass(), 'id' => $this->table->getId()))->andReturn(true);
     $table1 = $this->table->addColumn('foo')->render();
     $this->assertTrue($table1);
 }
コード例 #3
0
 public function testGetApiPrefix()
 {
     Config::shouldReceive('get')->with('andizzle/rest-framework::deprecated')->andReturn(array());
     Config::shouldReceive('get')->with('andizzle/rest-framework::version')->andReturn('v1');
     Request::shouldReceive('segments')->once()->andReturn(array('api', 'v1', 'test'));
     $server = new RestServer();
     $this->assertEquals($server->getApiPrefix(), '/api/v1');
 }
コード例 #4
0
 /**
  * NOTE: test is perform outside Laravel
  *
  * @test
  * @covers ::getCookieValue
  */
 public function canObtainCookieValue()
 {
     $this->stopLaravel();
     $key = $this->faker->word;
     $value = $this->faker->sentence;
     RequestFacade::shouldReceive('cookie')->with($key, null)->andReturn($value);
     $mock = $this->getTraitMock();
     $this->assertSame($value, $mock->getCookieValue($key), 'Incorrect value returned');
 }
コード例 #5
0
 /**
  * It should return a list of input and meta attributes
  *
  * @return void
  * @test
  */
 public function it_should_return_a_list_of_input_and_meta_attributes()
 {
     $ip = '192.168.1.1';
     $input = ['foo' => 'foo', 'bar' => 'bar'];
     Request::shouldReceive('ip')->withNoArgs()->once()->andReturn($ip);
     Request::shouldReceive('all')->withNoArgs()->once()->andReturn($input);
     $inputAndMetaAttributes = $this->requestMetaAttributes->getInputAndMetaAttributes();
     $expected = ['meta_ip_address' => $ip, 'foo' => 'foo', 'bar' => 'bar'];
     $this->assertEquals($expected, $inputAndMetaAttributes);
 }