public function throwingAnExceptionWhileIncluding()
{
// similar to Varien_Autoload
$innerException = null;
$autoload = $this->create(function ($className) use(&$innerException) {
$innerException = new \BadMethodCallException('exception in include simulation for ' . $className);
throw $innerException;
});
try {
$className = 'Le_Foo_Le_Bar_Nexiste_Pas';
ClassExistsChecker::create($className)->existsExtendsSafe();
$autoload->reset();
$this->fail('An expected Exception has not been thrown');
} catch (\Exception $ex) {
$autoload->reset();
$this->assertInstanceOf(__NAMESPACE__ . '\\ClassExistsThrownException', $ex);
$this->assertTrue($ex->getPrevious() instanceof $innerException);
$this->assertSame($innerException, $ex->getPrevious());
}
}