Ejemplo n.º 1
0
 /**
  * In this test, we will evaluate an undefined const,
  * because we know that the Function_const class is designed to 
  * log a warning.
  * One can wrap any implementation of the PSR-3 Logging they wish,
  * by supplying to FigDice a LoggerFactoryDelegate.
  * You supply a delegate by giving the FigDice's LoggerFactory static
  * utility class, an instance of figdice\LoggerFactoryDelegate.
  * This instance accepts the name of a class, and provides the corresponding
  * PSR-3 LoggerInterface of your choice.
  */
 public function testUnfedinedConstWillWarn()
 {
     $capturableLoggerInterface = new YouHaveBeenWarned();
     LoggerFactory::setDelegate(new TestLoggerFactoryDelegate($capturableLoggerInterface));
     $result = $this->lexExpr(" const('myUndefinedConst')  ");
     $this->assertEquals(false, $result);
     $this->assertContains('Undefined constant: myUndefinedConst', $capturableLoggerInterface->getCapturedWarnings());
 }