コード例 #1
0
 /**
  * @covers ::fromBacktrace
  */
 public function testRetrievesFileAndLineToo()
 {
     // ----------------------------------------------------------------
     // setup your test
     $backtrace = $this->getBacktrace();
     $expectedFile = '/tmp/jackpot';
     $expectedLine = 31415;
     // ----------------------------------------------------------------
     // perform the change
     $actualCaller = NonCheckCodeCaller::fromBacktrace($backtrace);
     // ----------------------------------------------------------------
     // test the results
     $this->assertEquals($expectedFile, $actualCaller[2]);
     $this->assertEquals($expectedLine, $actualCaller[3]);
 }
コード例 #2
0
 /**
  * work out who is throwing the exception
  *
  * we unwind the stack, looking for code that is NOT in these namespaces:
  *
  * - Checks
  * - Exceptions
  * - Requirements
  *
  * @return array
  *         the calling class, and the calling method
  */
 private function getNonCheckCaller()
 {
     $backtrace = debug_backtrace();
     return NonCheckCodeCaller::fromBacktrace($backtrace);
 }