public function ReadOnlyStorageTest::testEncodeDecode in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Config/ReadOnlyStorageTest.php \Drupal\Tests\Core\Config\ReadOnlyStorageTest::testEncodeDecode()
- 10 core/tests/Drupal/Tests/Core/Config/ReadOnlyStorageTest.php \Drupal\Tests\Core\Config\ReadOnlyStorageTest::testEncodeDecode()
@covers ::encode @covers ::decode
File
- core/
tests/ Drupal/ Tests/ Core/ Config/ ReadOnlyStorageTest.php, line 163
Class
- ReadOnlyStorageTest
- @coversDefaultClass \Drupal\Core\Config\ReadOnlyStorage @group Config
Namespace
Drupal\Tests\Core\ConfigCode
public function testEncodeDecode() {
$array = (array) $this
->getRandomGenerator()
->object();
$string = $this
->getRandomGenerator()
->string();
// Assert reversibility of encoding and decoding.
$this
->assertEquals($array, $this->storage
->decode($this->storage
->encode($array)));
$this
->assertEquals($string, $this->storage
->encode($this->storage
->decode($string)));
// Assert same results as the decorated storage.
$this
->assertEquals($this->memory
->encode($array), $this->storage
->encode($array));
$this
->assertEquals($this->memory
->decode($string), $this->storage
->decode($string));
}