ResettableStaticUnitTest.php in Zircon Profile 8
File
core/modules/system/src/Tests/Bootstrap/ResettableStaticUnitTest.php
View source
<?php
namespace Drupal\system\Tests\Bootstrap;
use Drupal\simpletest\KernelTestBase;
class ResettableStaticUnitTest extends KernelTestBase {
function testDrupalStatic() {
$name = __CLASS__ . '_' . __METHOD__;
$var =& drupal_static($name, 'foo');
$this
->assertEqual($var, 'foo', 'Variable returned by drupal_static() was set to its default.');
$var = 'bar';
drupal_static_reset($name);
$this
->assertEqual($var, 'foo', 'Variable was reset after first invocation of name-specific reset.');
$var = 'bar';
drupal_static_reset($name);
$this
->assertEqual($var, 'foo', 'Variable was reset after second invocation of name-specific reset.');
$var = 'bar';
drupal_static_reset();
$this
->assertEqual($var, 'foo', 'Variable was reset after first invocation of global reset.');
$var = 'bar';
drupal_static_reset();
$this
->assertEqual($var, 'foo', 'Variable was reset after second invocation of global reset.');
}
}