Vanilla\Addon::test PHP Method

test() public method

The test includes some of the files on this addon which will throw an exception if there are any major issues.
public test ( boolean $throw = true ) : boolean
$throw boolean Whether or not to throw an exception.
return boolean Returns **true** if the addon was successfully tested or **false** otherwise.
    public function test($throw = true)
    {
        try {
            // Include the plugin file.
            if ($className = $this->getPluginClass()) {
                list($_, $path) = $this->classes[$className];
                include $this->path($path);
            }
            // Include the configuration file.
            if ($configPath = $this->getSpecial('config')) {
                include $this->path($configPath);
            }
            // Include locale files.
            foreach ($this->getTranslationPaths() as $path) {
                include $this->path($path);
            }
            return true;
        } catch (\Throwable $ex) {
            // PHP 7 can trap more errors, so cast it into a PHP 5.x compatible exception.
            $ex2 = new \Exception($ex->getMessage(), $ex->getCode());
        } catch (\Exception $ex) {
            $ex2 = $ex;
        }
        if ($throw) {
            throw $ex2;
        } else {
            return false;
        }
    }