/** * Tests export. */ public function testToString() { $tests = array('noNamespace' => "Constant [ string NO_NAMESPACE ] { no-namespace }\n", 'typeString' => "Constant [ string TYPE_STRING ] { string }\n", 'typeInteger' => "Constant [ integer TYPE_INTEGER ] { 1 }\n", 'typeIntegerNegative' => "Constant [ integer TYPE_INTEGER_NEGATIVE ] { -1 }\n", 'typeFloat' => "Constant [ double TYPE_FLOAT ] { 1.1 }\n", 'typeFloatNegative' => "Constant [ double TYPE_FLOAT_NEGATIVE ] { -1.1 }\n", 'typeBoolean' => "Constant [ boolean TYPE_BOOLEAN ] { 1 }\n", 'typeNull' => "Constant [ null TYPE_NULL ] { }\n"); foreach ($tests as $test => $expected) { $this->assertSame($expected, $this->getConstantTokenReflection($test)->__toString()); $this->assertSame($expected, ReflectionConstant::export($this->getBroker(), $this->getClassName($test), $this->getConstantName($test), true)); // Test loading from a string $this->assertSame($expected, $this->getConstantTokenReflection($test, true)->__toString()); } $this->assertSame("Constant [ integer E_NOTICE ] { 8 }\n", ReflectionConstant::export($this->getBroker(), null, 'E_NOTICE', true)); }