HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/stempel.komma.pro/app/Komma/Shop/QualityAssurance/TestsController.php
<?php
namespace App\Komma\Shop\QualityAssurance;
use App\Komma\Kms\QualityAssurance\BaseTestController;

/**
 * Runs unit / feature / browser tests for the shop
 *
 * Class TestsController
 * @package App\Komma\Shop\
 */
//class TestsController extends BaseTestController implements TestsControllerInterface //TODO fix the interface
class TestsController extends BaseTestController
{
    public function __construct()
    {
        parent::__construct();

        $this->baseDirectory = lcfirst(str_replace('\\', '/',__NAMESPACE__)).'/../';
        $this->testsFolder = $this->baseDirectory.'Tests/';
        $this->screenshotFolder = $this->baseDirectory.'Tests/Browser/screenshots/';
    }

    /**
     * Makes sure the application is in an predictable state (always the same).
     */
    public function prepareEnvironment()
    {
        $this->showBanner('Setting up a predictable shop environment....');
        parent::prepareEnvironment();
        echo 'Running migrations'.PHP_EOL;
        \Artisan::call('migrate');
        echo 'Running seeds'.PHP_EOL;
        \Artisan::call('db:seed');
        echo 'Running shop migrations'.PHP_EOL;
        \Artisan::call('shop:migrate');
        echo 'Running shop seeds'.PHP_EOL;
        \Artisan::call('shop:seed');
        echo 'done'.PHP_EOL;
    }

    /**
     * returns true if the controller can run tests, false if not.
     *
     * @return bool
     */
    public function canTest()
    {
        $isShop = config('app.isShop');
        $shopPath = base_path('app/Komma/Shop');
        $hasShopInstallation = file_exists($shopPath);

        $shopEnabled = ($hasShopInstallation && $isShop);
        if(!$shopEnabled) {
            $this->echoResult([
                'TestsController: The shop is not enabled or present. Please check if the IS_SHOP env value is true and check if the following directory exists: '.$shopPath
            ]);
        }

        return $shopEnabled;
    }
}