<?phpnamespaceyiiunit;useyii\base\NotSupportedException;useYii;/** * This is the base class for all yii framework unit tests, which requires * external vendor libraries to function. */classVendorTestCaseextendsTestCase{
/** * This method is called before the first test of this test class is run. * Attempts to load vendor autoloader. * @throws \yii\base\NotSupportedException */publicstaticfunctionsetUpBeforeClass(){$vendorDir=__DIR__.'/../../vendor';if(!is_dir($vendorDir)){// this is used by `yii2-dev`$vendorDir=__DIR__.'/../../../../../vendor';}Yii::setAlias('@vendor',$vendorDir);$vendorAutoload=$vendorDir.'/autoload.php';if(file_exists($vendorAutoload)){require_once($vendorAutoload);}else{thrownewNotSupportedException("Vendor autoload file '{$vendorAutoload}' is missing.");}}