mageekguy\atoum\asserters\extension::isLoaded PHP 메소드

isLoaded() 공개 메소드

public isLoaded ( $failMessage = null )
    public function isLoaded($failMessage = null)
    {
        $extension = call_user_func($this->phpExtensionFactory, $this->valueIsSet()->name);
        try {
            $extension->requireExtension();
            $this->pass();
        } catch (atoum\php\exception $exception) {
            $this->fail($failMessage ?: $this->_('PHP extension \'%s\' is not loaded', $this));
        }
        return $this;
    }

Usage Example

예제 #1
0
 public function testIsLoaded()
 {
     $this->if($asserter = new sut(new asserter\generator()))->then->exception(function () use($asserter) {
         $asserter->isLoaded();
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Name of PHP extension is undefined')->if($asserter->setAdapter($adapter = new atoum\test\adapter()))->and($adapter->extension_loaded = false)->and($asserter->setWith($extensionName = uniqid()))->then->exception(function () use($asserter) {
         $asserter->isLoaded();
     })->isInstanceOf('mageekguy\\atoum\\test\\exceptions\\skip')->hasMessage('PHP extension \'' . $extensionName . '\' is not loaded')->if($adapter->extension_loaded = true)->then->object($asserter->isLoaded())->isIdenticalTo($asserter);
 }