public function ViewsTest::testGetNonExistentView in Drupal 10
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Unit/ViewsTest.php \Drupal\Tests\views\Unit\ViewsTest::testGetNonExistentView()
- 9 core/modules/views/tests/src/Unit/ViewsTest.php \Drupal\Tests\views\Unit\ViewsTest::testGetNonExistentView()
Tests the getView() method against a non-existent view.
@covers ::getView
File
- core/
modules/ views/ tests/ src/ Unit/ ViewsTest.php, line 81
Class
- ViewsTest
- @coversDefaultClass \Drupal\views\Views @group views
Namespace
Drupal\Tests\views\UnitCode
public function testGetNonExistentView() {
$entity_type_manager = $this
->prophesize(EntityTypeManagerInterface::class);
$storage = $this
->prophesize(EntityStorageInterface::class);
$storage
->load('test_view_non_existent')
->willReturn(NULL);
$entity_type_manager
->getStorage('view')
->willReturn($storage
->reveal());
$this->container
->set('entity_type.manager', $entity_type_manager
->reveal());
$executable_does_not_exist = Views::getView('test_view_non_existent');
$this
->assertNull($executable_does_not_exist);
}