addProperty(new PropertyNode('stringProp', 'public', new ScalarNode('string', 'value'))); $node->addProperty(new PropertyNode('intProp', 'protected', new ScalarNode('int', 1))); $node->addProperty(new PropertyNode('floatProp', 'protected', new ScalarNode('float', 1.1))); $node->addProperty(new PropertyNode('boolProp', 'protected', new ScalarNode('bool', true))); $node->addProperty(new PropertyNode('nullProp', 'private', new ScalarNode('null', null))); $arrayNode = new ArrayNode([ new ArrayItemNode(new ScalarNode('string', ''), new SpecialNode('too much')), new ArrayItemNode(new ScalarNode('int', 1), new ReferenceNode('MyObject', 1)), ]); $node->addProperty(new PropertyNode('arrayProp', 'public', $arrayNode)); $formatter = new ConsoleFormatter(); $result = $formatter->dump($node); $this->assertStringContainsString("\033[1;33m", $result, 'Should contain yellow code'); $this->assertStringContainsString("\033[0;32m", $result, 'Should contain green code'); $this->assertStringContainsString("\033[1;34m", $result, 'Should contain blue code'); $this->assertStringContainsString("\033[0;36m", $result, 'Should contain cyan code'); $expected = << 'value' protected intProp => (int) 1 protected floatProp => (float) 1.1 protected boolProp => true private nullProp => null arrayProp => [ '' => too much, (int) 1 => object(MyObject) id:1 {} ] } TEXT; $noescape = preg_replace('/\\033\[\d\;\d+\;m([^\\\\]+)\\033\[0m/', '$1', $expected); $this->assertSame($expected, $noescape); } }