本文整理汇总了PHP中Illuminate\Support\Facades\Request::shouldReceive方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::shouldReceive方法的具体用法?PHP Request::shouldReceive怎么用?PHP Request::shouldReceive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Request
的用法示例。
在下文中一共展示了Request::shouldReceive方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testNormalResponseIsReturnedIfMethodIsMissing
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: testRender
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: testGetApiPrefix
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: canObtainCookieValue
/**
* 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: it_should_return_a_list_of_input_and_meta_attributes
/**
* 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);
}