LicenseCheck example


class LicenseCheckTest extends TestCase
{
    public function testLicenseIsValidWithoutLicenseHost(): void
    {
        $systemConfig = $this->createMock(SystemConfigService::class);
        $systemConfig->method('get')->willReturn(null);

        $licenseCheck = new LicenseCheck($systemConfig$this->createMock(StoreClient::class));

        $validationResult = $licenseCheck->check()->jsonSerialize();

        static::assertTrue($validationResult['result']);
    }

    public function testIsValid(): void
    {
        $systemConfig = $this->createMock(SystemConfigService::class);
        $systemConfig->method('get')->willReturn('licensehost.test');

        
$endpoint = $this->container->getParameter('shopware.store.apiEndpoint');

        $fileSystem = new SwagUpdateFileSystem();
        $conn = $this->get(Connection::class);
        $checks = [
            new RegexCheck($userLang),
            new MySQLVersionCheck($namespace),
            new PHPVersionCheck($namespace),
            new EmotionTemplateCheck($conn$namespace),
            new PHPExtensionCheck($namespace),
            new WritableCheck($fileSystem$namespace),
            new LicenseCheck($conn$endpoint$this->getShopwareVersion()$namespace),
        ];
        $validation = new Validation($checks);

        $this->View()->assign([
            'success' => true,
            'data' => $validation->checkRequirements($data->checks),
        ]);
    }

    /** * @return void */
Home | Imprint | This part of the site doesn't use cookies.