예제 #1
0
 public function testAppender()
 {
     $logger = new Logger('logger');
     /** @var $appender AppenderAbstract */
     $appender = $this->getMockForAbstractClass(AppenderAbstract::class);
     /** @var $appenderSecond AppenderAbstract */
     $appenderSecond = clone $appender;
     $this->assertSame([], $logger->getAppenders());
     $logger->addAppender($appender);
     $this->assertSame([$appender], $logger->getAppenders());
     $logger->addAppender($appender);
     $this->assertSame([$appender], $logger->getAppenders());
     $logger->addAppender($appenderSecond);
     $this->assertSame([$appender, $appenderSecond], $logger->getAppenders());
     $logger->addAppender($appenderSecond);
     $this->assertSame([$appender, $appenderSecond], $logger->getAppenders());
     $logger->removeAppender($appenderSecond);
     $this->assertSame([$appender], $logger->getAppenders());
     $logger->removeAppender($appender);
     $this->assertSame([], $logger->getAppenders());
 }