예제 #1
0
 /**
  * @test
  * @depends listLevelsTest
  */
 public function isTest()
 {
     $list = Level::listLevels();
     $mask = 0;
     foreach ($list as $name => $level) {
         $this->assertTrue(Level::is($level));
         $mask = BitMask::addFlag($mask, $level);
     }
     $this->assertTrue(Level::is($mask));
     $this->assertFalse(Level::is(1 << 10));
 }
예제 #2
0
 /**
  * @test
  * @depends addTest
  * @depends addTest2
  */
 public function flagsTest()
 {
     $flags = [];
     $mask = 0;
     while (\count($flags) < 5) {
         $power = \mt_rand(0, 10);
         $flag = \pow(2, $power);
         $flags[] = $flag;
         $mask = BitMask::addFlag($mask, $flag);
     }
     $flags = \array_unique($flags);
     \sort($flags);
     $flags2 = BitMask::maskToFlags($mask);
     $this->assertTrue($flags === $flags2);
 }
예제 #3
0
 /**
  * Attach a logger handler on the end of list.
  * 
  * @param HandlerInterface $handler
  * @return self
  */
 public function pushHandler(HandlerInterface $handler)
 {
     $this->handlers[] = $handler;
     $this->level = BitMask::addFlag($this->level, $handler->getHandledLevel());
     return $this;
 }