Beispiel #1
0
 /**
  * We don't log to detached observers.
  */
 public function testDontLogToDetached()
 {
     $dateTime = new \DateTime();
     $expectedMessage = 'This is the message.';
     $expectedLevel = 'User Notice';
     $detached = 3;
     $object = new Logging($dateTime);
     $observers = [];
     for ($i = 0; $i < 4; $i++) {
         $observers[$i] = $this->createMock('Evoke\\Service\\Log\\LoggerIface');
         if ($i === $detached) {
             $observers[$i]->expects($this->never())->method('log');
         } else {
             $observers[$i]->expects($this->once())->method('log')->with($dateTime, $expectedMessage, $expectedLevel);
         }
         $object->attach($observers[$i]);
     }
     $object->detach($observers[$detached]);
     $object->log('This is the message.', E_USER_NOTICE);
 }