function ViewUIObjectTest::testSerialization
Same name in other branches
- 8.9.x core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php \Drupal\Tests\views_ui\Unit\ViewUIObjectTest::testSerialization()
- 10 core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php \Drupal\Tests\views_ui\Unit\ViewUIObjectTest::testSerialization()
- 11.x core/modules/views_ui/tests/src/Unit/ViewUIObjectTest.php \Drupal\Tests\views_ui\Unit\ViewUIObjectTest::testSerialization()
Tests serialization of the ViewUI object.
File
-
core/
modules/ views_ui/ tests/ src/ Unit/ ViewUIObjectTest.php, line 116
Class
- ViewUIObjectTest
- @coversDefaultClass \Drupal\views_ui\ViewUI @group views_ui
Namespace
Drupal\Tests\views_ui\UnitCode
public function testSerialization() {
$storage = new View([], 'view');
$executable = $this->getMockBuilder('Drupal\\views\\ViewExecutable')
->disableOriginalConstructor()
->setConstructorArgs([
$storage,
])
->getMock();
$storage->set('executable', $executable);
$view_ui = new ViewUI($storage);
// Make sure the executable is returned before serializing.
$this->assertInstanceOf('Drupal\\views\\ViewExecutable', $view_ui->getExecutable());
$serialized = serialize($view_ui);
// Make sure the ViewExecutable class is not found in the serialized string.
$this->assertStringNotContainsString('"Drupal\\views\\ViewExecutable"', $serialized);
$unserialized = unserialize($serialized);
$this->assertInstanceOf('Drupal\\views_ui\\ViewUI', $unserialized);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.