1,\n)", ['a' => 1], ], // Bool. [ 'TRUE', TRUE, ], [ 'FALSE', FALSE, ], // Strings. [ "'string'", 'string', ], [ '"\n\r\t"', "\n\r\t", ], [ // 2 backslashes. \\ "'\\'", '\\', ], [ // Double-quote " "'\"'", "\"", ], [ // Single-quote ' '"\'"', "'", ], [ // Quotes with $ symbols. '"\$settings[\'foo\']"', '$settings[\'foo\']', ], // Object. [ // A stdClass object. '(object) array()', new \stdClass(), ], [ // A not-stdClass object. "Drupal\Tests\Component\Utility\StubVariableTestClass::__set_state(array(\n))", new StubVariableTestClass(), ], ]; } /** * Tests exporting variables. * * @dataProvider providerTestExport * @covers ::export * * @param string $expected * The expected exported variable. * @param mixed $variable * The variable to be exported. */ public function testExport($expected, $variable) { $this->assertEquals($expected, Variable::export($variable)); } } /** * No-op test class for VariableTest::testExport(). * * @see Drupal\Tests\Component\Utility\VariableTest::testExport() * @see Drupal\Tests\Component\Utility\VariableTest::providerTestExport() */ class StubVariableTestClass { }