function test_string_cache() { $string = 'x'; $string_with_color = '%k' . $string; $colorized_string = "[30m{$string}"; // Ensure colorization works $this->assertEquals(\cli\Colors::colorize($string_with_color, true), $colorized_string); // Test that the value was cached appropriately $test_cache = array('passed' => $string_with_color, 'colorized' => $colorized_string, 'decolorized' => $string); $real_cache = \cli\Colors::getStringCache(); // Test that the cache value exists $this->assertTrue(isset($real_cache[md5($string_with_color)])); // Test that the cache value is correctly set $this->assertEquals($test_cache, $real_cache[md5($string_with_color)]); }