本文整理汇总了PHP中Illuminate\Support\Facades\View::shouldReceive方法的典型用法代码示例。如果您正苦于以下问题:PHP View::shouldReceive方法的具体用法?PHP View::shouldReceive怎么用?PHP View::shouldReceive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\View
的用法示例。
在下文中一共展示了View::shouldReceive方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPjaxAndFullpageResponses
public function testPjaxAndFullpageResponses()
{
$this->mockRequest->shouldReceive('wantsJson')->andReturn(false);
View::shouldReceive('make')->with('view', [], [])->once()->andReturn('view');
$this->respondable->respond('view');
$this->assertEquals('whatever', $this->respondable->layout->main);
}
示例2: testIndex
public function testIndex()
{
$this->markTestIncomplete('This test has not been implemented yet.');
View::shouldReceive('make')->once()->with('cabinet::admin.index')->andReturn('admin index!');
$response = $this->action('GET', self::$wardrobeControllers . 'AdminController@index');
$this->assertSame('admin index!', $response->original);
}
示例3: testAssertViewIs
public function testAssertViewIs()
{
View::shouldReceive('make')->once()->with('foo');
$this->response->shouldReceive('getOriginalContent')->once()->andReturn(Mockery::mock(['getName' => 'foo']));
$this->controller->show();
$this->assertViewis('foo');
}
示例4: testGetViewReturnsDefaultViewWithNoView
public function testGetViewReturnsDefaultViewWithNoView()
{
$template = new Template();
View::shouldReceive('exists')->with(\Mockery::any())->andReturn(false);
View::shouldReceive('make')->with('boomcms::templates.default');
$template->getView();
}
示例5: testPjaxRequest
public function testPjaxRequest()
{
$this->mockRequest->shouldReceive('wantsJson')->andReturn(false);
$this->mockRequest->shouldReceive('header')->with('X-PJAX')->twice()->andReturn('true');
View::shouldReceive('make')->with('shift::layouts.pjax', [], [])->once();
$this->controller->setup();
}
示例6: testRender
public function testRender()
{
View::shouldReceive('make')->once()->with('datatable::template', \Mockery::any())->andReturn(true);
$this->table->setUrl('fooBar');
$table1 = $this->table->addColumn('foo')->render();
$this->assertEquals(array('options' => '{ "sPaginationType":"full_numbers",' . PHP_EOL . '"bProcessing":false,' . PHP_EOL . '"sAjaxSource":"fooBar",' . PHP_EOL . '"bServerSide":true }', 'values' => array(), 'data' => array(), 'columns' => array(1 => 'foo'), 'noScript' => false, 'class' => $this->table->getClass(), 'id' => $this->table->getId()), $this->table->getViewParameters());
$this->assertTrue($table1);
}
示例7: testViewUsesNamespaceOfActivePageTemplate
public function testViewUsesNamespaceOfActivePageTemplate()
{
$template = new Template(['theme' => 'test']);
$page = $this->getMock(Page::class, ['getTemplate']);
$page->expects($this->once())->method('getTemplate')->will($this->returnValue($template));
Editor::shouldReceive('getActivePage')->andReturn($page);
View::shouldReceive('make')->with('test::name', [])->andReturn('view');
$this->assertEquals('view', Helpers::view('name'));
}
示例8: testExecuteMethod
/**
* Specs for RouteGenerator::execute()
*/
public function testExecuteMethod()
{
$class = $this->prepareSpecify();
$this->specify('renders if one class name is passed.', function () use($class) {
View::shouldReceive('make->render')->once()->andReturn('test output');
$params = ['element' => 'test'];
expect($class->execute($params))->equals('test output');
});
}
示例9: testSendSMSNotification
public function testSendSMSNotification()
{
$twilioClient = new stdClass();
$twilioClient->account = new stdClass();
$messageService = Mockery::mock('stdClass');
$twilioClient->account->sms_messages = $messageService;
$messageService->shouldReceive('create')->once()->with('1234', 'fooUser', 'renderedContent');
$viewContent = Mockery::mock('stdClass');
$viewContent->shouldReceive('render')->once()->andReturn('renderedContent');
$sms = new \Skovachev\Notifier\Notifiers\SMSNotifier($twilioClient);
Config::shouldReceive('get')->once()->with('notifier::sms.enabled')->andReturn(true);
Config::shouldReceive('get')->once()->with('notifier::sms.getter_phone')->andReturn(function ($user) {
return $user;
});
Config::shouldReceive('get')->once()->with('notifier::sms.twilio.phone_number')->andReturn('1234');
Config::shouldReceive('get')->once()->with('notifier::views_folder')->andReturn('foobar');
View::shouldReceive('make')->once()->with('foobar.sms.fooView', array('foo' => 'bar', 'user' => 'fooUser'))->andReturn($viewContent);
$sms->notify('fooUser', 'fooView', array('foo' => 'bar'));
}
示例10: testExecuteMethod
/**
* Specs for Generator::execute()
*/
public function testExecuteMethod()
{
$class = $this->prepareSpecify();
$this->specify('renders if one class name is passed.', function () use($class) {
View::shouldReceive('make->render')->once()->andReturn('test output');
File::shouldReceive('exists')->twice()->with('/\\.php$/')->andReturn(false);
File::shouldReceive('put')->once()->with('/\\.php$/', 'test output')->andReturn(true);
$params = ['classes' => ['test' => []]];
expect($class->execute($params))->greaterThan(0);
});
$this->specify('does not count failed views.', function () use($class) {
View::shouldReceive('make->render')->once()->andReturn('test output');
File::shouldReceive('exists')->twice()->with('/\\.php$/')->andReturn(false);
File::shouldReceive('put')->once()->with('/\\.php$/', 'test output')->andReturn(false);
$params = ['classes' => ['test' => []]];
expect($class->execute($params))->equals(0);
});
$this->specify('keeps overridden view.', function () use($class) {
View::shouldReceive('make')->once()->with('test::view', Mockery::type('array'));
View::shouldReceive('make->render')->once()->andReturn('test output');
File::shouldReceive('exists')->twice()->with('/\\.php$/')->andReturn(false);
File::shouldReceive('put')->once()->with('/\\.php$/', 'test output')->andReturn(true);
$params = ['classes' => ['test' => []]];
expect($class->execute($params))->greaterThan(0);
});
}
示例11: testRemindForm
public function testRemindForm()
{
View::shouldReceive('make')->once()->with('cabinet::admin.auth.forgot')->andReturn('forgot my password');
$response = $this->action('GET', self::$wardrobeControllers . 'LoginController@remindForm');
$this->assertSame('forgot my password', $response->original);
}
示例12: testLinkWithPermissionsAllowed
public function testLinkWithPermissionsAllowed()
{
$this->mockPermissonsService->shouldReceive('permits')->once()->with(['User' => 'write'])->andReturn(true);
View::shouldReceive('make')->with('shift::html.buttons.link', ['title' => 'Edit user', 'url' => 'users/edit/1', 'icon' => '', 'iconClass' => '', 'size' => 'big', 'type' => ''])->once()->andReturn('permitted button');
$this->assertEquals('permitted button', $this->buttonBuilder->link('users/edit/1', 'Edit user', ['permissions' => ['User' => 'write']]));
}