/** * @param cfhCompile_Compiler_Event $event */ public function notify(cfhCompile_Compiler_Event $event) { $msg = ''; switch ($event->getEvent()) { case cfhCompile_Compiler_Event::EVENT_BEGIN: $msg .= 'BEGIN '; break; case cfhCompile_Compiler_Event::EVENT_CLASS: $msg .= 'CLASS '; break; case cfhCompile_Compiler_Event::EVENT_COMMIT: $msg .= 'COMMIT '; break; case cfhCompile_Compiler_Event::EVENT_ROLLBACK: $msg .= 'ROLLBACK '; break; case cfhCompile_Compiler_Event::EVENT_SKIP: $msg .= 'SKIP '; break; case cfhCompile_Compiler_Event::EVENT_NOTFOUND: $msg .= 'NOTFOUND '; break; case cfhCompile_Compiler_Event::EVENT_WRITE: $msg .= 'WRITE '; break; } if ($event->getClass()) { $msg .= $event->getClass()->getName(); } $msg = trim($msg) . PHP_EOL; fwrite($this->fp, $msg, strlen($msg)); }
public function testConstruction() { $eventId = cfhCompile_Compiler_Event::EVENT_BEGIN; $compiler = $this->getMock('cfhCompile_Compiler'); $classIterator = $this->getMock('cfhCompile_ClassIterator_Interface'); $reader = $this->getMock('cfhCompile_CodeReader_ReadStrategy_Interface'); $writer = $this->getMock('cfhCompile_CodeWriter_WriteStrategy_Interface'); $registry = $this->getMock('cfhCompile_ClassRegistry'); $class = $this->getMock('cfhCompile_Class_Interface'); $event = new cfhCompile_Compiler_Event($eventId, $compiler, $classIterator, $reader, $writer, $registry, $class); $this->assertSame($eventId, $event->getEvent()); $this->assertSame($compiler, $event->getCompiler()); $this->assertSame($classIterator, $event->getClassIterator()); $this->assertSame($reader, $event->getCodeReader()); $this->assertSame($writer, $event->getCodeWriter()); $this->assertSame($registry, $event->getClassRegistry()); $this->assertSame($class, $event->getClass()); $this->assertNotEquals($this->event->getId(), $event->getId()); }