public function testGetSourceCodeThisClass() { $c = new cfhCompile_Class_Reflection($this); $r = new cfhCompile_CodeReader_ReadStrategy_Tokenizer(); $code = @file(__FILE__, FILE_IGNORE_NEW_LINES); $offset = $c->getStartLine() - 1; $length = $c->getEndLine() - $offset; $code = trim(implode(PHP_EOL, array_slice($code, $offset, $length))); $this->assertEquals($code, $r->getSourceCode($c)); }
public function testEvalClass() { $mock = $this->getMock('stdClass'); $c = new cfhCompile_Class_Reflection($mock); $this->assertEquals(get_class($mock), $c->getName()); $this->assertNull($c->getFileName()); $this->assertNull($c->getStartLine()); $this->assertNull($c->getEndLine()); $this->assertFalse($c->isInterface()); $deps = $c->getDependancys(); $this->assertTrue(count($deps) == 3); $this->assertEquals('stdClass', current($deps)); $this->assertEquals('PHPUnit_Framework_MockObject_MockObject', next($deps)); $this->assertEquals('PHPUnit_Framework_MockObject_Verifiable', next($deps)); }