Example #1
0
 /**
  * @param string $date
  * @param string $author
  * @param string|null $label
  * @param array $trace
  */
 public function tombstone($date, $author, $label, array $trace)
 {
     $trace = $this->traceRelativePath($trace);
     $vampire = Vampire::createFromCall($date, $author, $label, $trace);
     foreach ($this->handlers as $handler) {
         $handler->log($vampire);
     }
 }
Example #2
0
 /**
  * @test
  */
 public function createFromCall_dataGiven_returnCorrectlyConstructedVampire()
 {
     $stackTrace = TraceFixture::getTraceFixture();
     $vampire = Vampire::createFromCall('2015-08-19', 'author', 'label', $stackTrace);
     $this->assertInstanceOf('Scheb\\Tombstone\\Vampire', $vampire);
     $this->assertInstanceOf('Scheb\\Tombstone\\Tombstone', $vampire->getTombstone());
     $this->assertEquals('2015-08-19', $vampire->getTombstoneDate());
     $this->assertEquals('author', $vampire->getAuthor());
     $this->assertEquals('label', $vampire->getLabel());
     $this->assertEquals('/path/to/file1.php', $vampire->getFile());
     $this->assertEquals(11, $vampire->getLine());
     $this->assertEquals('containingMethodName', $vampire->getMethod());
     $this->assertEquals('invokerMethodName', $vampire->getInvoker());
     $invocationDate = strtotime($vampire->getInvocationDate());
     $this->assertEquals(time(), $invocationDate, null, 5);
 }