protected function FieldsTest::getMockedView in Layout Plugin Views 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/FieldsTest.php \Drupal\Tests\layout_plugin_views\Unit\FieldsTest::getMockedView()
returns a static mocked view.
Parameters
bool $reset: Set this to true if the view should be reset.
bool $add_fields: Set this to false if no fields should be added.
Return value
\PHPUnit_Framework_MockObject_MockObject
2 calls to FieldsTest::getMockedView()
- FieldsTest::excludedFieldIsNotRendered in tests/
src/ Unit/ FieldsTest.php - @test
- FieldsTest::initializeSubjectUnderTest in tests/
src/ Unit/ FieldsTest.php
File
- tests/
src/ Unit/ FieldsTest.php, line 355
Class
- FieldsTest
- @coversDefaultClass \Drupal\layout_plugin_views\Plugin\views\row\Fields @group Panels
Namespace
Drupal\Tests\layout_plugin_views\UnitCode
protected function getMockedView($reset = FALSE, $add_fields = TRUE) {
static $view;
if (!$view || $reset) {
$view = $this
->getMockBuilder(ViewExecutable::class)
->disableOriginalConstructor()
->getMock();
$view->field = [];
if ($add_fields) {
foreach ([
'somefield',
'some_other_field',
] as $field_name) {
$this
->addFieldToMockedView($field_name, $view);
}
}
}
return $view;
}