abstract class ViewsXmlBackendTestBase in Views XML Backend 8
Base testing class.
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\views_xml_backend\Unit\ViewsXmlBackendTestBase
Expanded class hierarchy of ViewsXmlBackendTestBase
13 files declare their use of ViewsXmlBackendTestBase
- DateTest.php in tests/
src/ Unit/ Plugin/ views/ sort/ DateTest.php - Contains \Drupal\Tests\views_xml_backend\Unit\Plugin\views\sort\DateTest.
- DateTest.php in tests/
src/ Unit/ Plugin/ views/ field/ DateTest.php - Contains \Drupal\Tests\views_xml_backend\Unit\Plugin\views\field\DateTest.
- MarkupTest.php in tests/
src/ Unit/ Plugin/ views/ field/ MarkupTest.php - Contains \Drupal\Tests\views_xml_backend\Unit\Plugin\views\field\MarkupTest.
- NumericTest.php in tests/
src/ Unit/ Plugin/ views/ filter/ NumericTest.php - Contains \Drupal\Tests\views_xml_backend\Unit\Plugin\views\filter\NumericTest.
- NumericTest.php in tests/
src/ Unit/ Plugin/ views/ sort/ NumericTest.php - Contains \Drupal\Tests\views_xml_backend\Unit\Plugin\views\sort\NumericTest.
File
- tests/
src/ Unit/ ViewsXmlBackendTestBase.php, line 19 - Contains \Drupal\Tests\views_xml_backend\Unit\ViewsXmlBackendTestBase.
Namespace
Drupal\Tests\views_xml_backend\UnitView source
abstract class ViewsXmlBackendTestBase extends UnitTestCase {
protected $display;
protected $view;
public function setUp() {
parent::setUp();
if (!defined('REQUEST_TIME')) {
define('REQUEST_TIME', time());
}
require_once dirname(dirname(dirname(__DIR__))) . '/views_xml_backend.module';
}
protected function getMockedView() {
if (isset($this->view)) {
return $this->view
->reveal();
}
$this->view = $this
->prophesize(ViewExecutable::class);
$this->view->display_handler = $this
->getMockedDisplay();
$this->view
->getDisplay()
->willReturn($this
->getMockedDisplay());
$this->view
->initPager()
->willReturn(TRUE);
$this->view
->getStyle()
->willReturn(new DefaultStyle([], '', []));
$this->view->pager = new None([], '', []);
$this->view->field = [];
return $this->view
->reveal();
}
protected function getMockedDisplay() {
if (isset($this->display)) {
return $this->display
->reveal();
}
$this->display = $this
->prophesize(DisplayPluginBase::class);
$this->display
->getArgumentsTokens()
->willReturn([]);
$this->display
->getOption('relationships')
->willReturn(FALSE);
return $this->display
->reveal();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
ViewsXmlBackendTestBase:: |
protected | property | ||
ViewsXmlBackendTestBase:: |
protected | property | ||
ViewsXmlBackendTestBase:: |
protected | function | ||
ViewsXmlBackendTestBase:: |
protected | function | ||
ViewsXmlBackendTestBase:: |
public | function |
Overrides UnitTestCase:: |
1 |