protected function ViewAjaxControllerTest::setupValidMocks in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/tests/src/Unit/Controller/ViewAjaxControllerTest.php \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest::setupValidMocks()
Sets up a bunch of valid mocks like the view entity and executable.
4 calls to ViewAjaxControllerTest::setupValidMocks()
- ViewAjaxControllerTest::testAjaxView in core/
modules/ views/ tests/ src/ Unit/ Controller/ ViewAjaxControllerTest.php - Tests a valid view without arguments pagers etc.
- ViewAjaxControllerTest::testAjaxViewWithArguments in core/
modules/ views/ tests/ src/ Unit/ Controller/ ViewAjaxControllerTest.php - Tests a valid view with arguments.
- ViewAjaxControllerTest::testAjaxViewWithEmptyArguments in core/
modules/ views/ tests/ src/ Unit/ Controller/ ViewAjaxControllerTest.php - Tests a valid view with arguments.
- ViewAjaxControllerTest::testAjaxViewWithPager in core/
modules/ views/ tests/ src/ Unit/ Controller/ ViewAjaxControllerTest.php - Tests a valid view with a pager.
File
- core/
modules/ views/ tests/ src/ Unit/ Controller/ ViewAjaxControllerTest.php, line 299 - Contains \Drupal\Tests\views\Unit\Controller\ViewAjaxControllerTest.
Class
- ViewAjaxControllerTest
- @coversDefaultClass \Drupal\views\Controller\ViewAjaxController @group views
Namespace
Drupal\Tests\views\Unit\ControllerCode
protected function setupValidMocks() {
$view = $this
->getMockBuilder('Drupal\\views\\Entity\\View')
->disableOriginalConstructor()
->getMock();
$this->viewStorage
->expects($this
->once())
->method('load')
->with('test_view')
->will($this
->returnValue($view));
$executable = $this
->getMockBuilder('Drupal\\views\\ViewExecutable')
->disableOriginalConstructor()
->getMock();
$executable
->expects($this
->once())
->method('access')
->will($this
->returnValue(TRUE));
$executable
->expects($this
->once())
->method('preview')
->will($this
->returnValue(array(
'#markup' => 'View result',
)));
$this->executableFactory
->expects($this
->once())
->method('get')
->with($view)
->will($this
->returnValue($executable));
return array(
$view,
$executable,
);
}