isActive example

static::assertNotNull($appId);

        $criteria = new Criteria([$appId]);
        $criteria->addAssociation('templates');
        $criteria->addAssociation('paymentMethods.paymentMethod');
        $criteria->addAssociation('scripts');
        $criteria->addAssociation('scriptConditions');

        /** @var AppEntity|null $app */
        $app = $this->appRepository->search($criteria$this->context)->first();
        static::assertNotNull($app);
        static::assertSame($active$app->isActive());
        $this->assertDefaultTemplate($app);
        $this->assertDefaultPaymentMethods($app);
        $this->assertDefaultScripts($app);
        $this->assertDefaultScriptConditions($app);
    }

    private function assertDefaultTemplate(AppEntity $app): void
    {
        static::assertNotNull($app->getTemplates());
        $template = $app->getTemplates()->first();

        
'en-GB' => 'Second',
            ],
        ]$singleSelectField->getOptions());
    }

    public function testToEntityArray(): void
    {
        $singleSelectField = $this->importCustomField(__DIR__ . '/_fixtures/single-select-field.xml');

        static::assertEquals('test_single_select_field', $singleSelectField->getName());
        static::assertEquals('select', $singleSelectField->getType());
        static::assertTrue($singleSelectField->isActive());
        static::assertEquals([
            'label' => [
                'en-GB' => 'Test single-select field',
            ],
            'helpText' => [],
            'placeholder' => [
                'en-GB' => 'Choose an option...',
            ],
            'componentName' => 'sw-single-select',
            'customFieldType' => 'select',
            'customFieldPosition' => 1,
            
$frwService = $this->createFirstRunWizardService(
            systemConfigService: $systemConfigService,
            frwClient: $frwClient,
        );

        $licenseDomains = $frwService->getLicenseDomains($this->context);

        $currentLicenseDomain = $licenseDomains->first();
        static::assertInstanceOf(LicenseDomainStruct::class$currentLicenseDomain);
        static::assertEquals('täst.de', $currentLicenseDomain->getDomain());
        static::assertTrue($currentLicenseDomain->isActive());

        $otherLicenseDomain = $licenseDomains->last();
        static::assertInstanceOf(LicenseDomainStruct::class$otherLicenseDomain);
        static::assertEquals('shopware.swag', $otherLicenseDomain->getDomain());
        static::assertFalse($otherLicenseDomain->isActive());
    }

    public function testRecommendationRegions(): void
    {
        $frwClient = $this->createMock(FirstRunWizardClient::class);
        $frwClient->expects(static::once())
            
'url' => 'http://test.to',
                ],
            ],
        ]);
    }

    /** * @deprecated tag:v6.6.0.0 - Method will be removed. Use `loadCombinations` instead. */
    public function testCombinationsAreInResultDeprecated(): void
    {
        if (Feature::isActive('v6.6.0.0')) {
            static::markTestSkipped('The load method has been deprecated and will be removed in v6.6.0.0');
        }

        $context = Context::createDefaultContext();
        $productId = $this->createProduct($context);
        $result = $this->loader->load($productId$context, TestDefaults::SALES_CHANNEL);

        foreach ($result->getCombinations() as $combinationHash => $combination) {
            static::assertTrue($result->hasCombination($combination));

            foreach ($combination as $optionId) {
                
static::assertEquals([]$colorPickerField->getHelpText());
        static::assertEquals(1, $colorPickerField->getPosition());
        static::assertFalse($colorPickerField->getRequired());
    }

    public function testToEntityArray(): void
    {
        $colorPickerField = $this->importCustomField(__DIR__ . '/_fixtures/color-picker-field.xml');

        static::assertEquals('test_color_picker_field', $colorPickerField->getName());
        static::assertEquals('text', $colorPickerField->getType());
        static::assertTrue($colorPickerField->isActive());
        static::assertEquals([
            'type' => 'colorpicker',
            'label' => [
                'en-GB' => 'Test color-picker field',
            ],
            'helpText' => [],
            'componentName' => 'sw-field',
            'customFieldType' => 'colorpicker',
            'customFieldPosition' => 1,
        ]$colorPickerField->getConfig());
    }
}
$edit = [
      'user_bulk_form[1]' => TRUE,
      'action' => 'user_remove_role_action.' . $role,
    ];
    $this->submitForm($edit, 'Apply to selected items');
    // Re-load the user and check their roles.     $user_storage->resetCache([$account->id()]);
    $account = $user_storage->load($account->id());
    $this->assertFalse($account->hasRole($role), 'The user no longer has the custom role.');

    // Block a user using the bulk form.     $this->assertTrue($account->isActive(), 'The user is not blocked.');
    $this->assertSession()->pageTextContains($account->label());
    $edit = [
      'user_bulk_form[1]' => TRUE,
      'action' => 'user_block_user_action',
    ];
    $this->submitForm($edit, 'Apply to selected items');
    // Re-load the user and check their status.     $user_storage->resetCache([$account->id()]);
    $account = $user_storage->load($account->id());
    $this->assertTrue($account->isBlocked(), 'The user is blocked.');
    $this->assertSession()->pageTextNotContains($account->label());

    
public const MEDIA_INVALID_FILE_SYSTEM_VISIBILITY = 'CONTENT__MEDIA_INVALID_FILE_SYSTEM_VISIBILITY';
    public const MEDIA_FILE_IS_NOT_INSTANCE_OF_FILE_SYSTEM = 'CONTENT__MEDIA_FILE_IS_NOT_INSTANCE_OF_FILE_SYSTEM';
    public const MEDIA_MISSING_URL_PARAMETER = 'CONTENT__MEDIA_MISSING_URL_PARAMETER';
    public const MEDIA_CANNOT_CREATE_TEMP_FILE = 'CONTENT__MEDIA_CANNOT_CREATE_TEMP_FILE';
    public const MEDIA_FILE_NOT_FOUND = 'CONTENT__MEDIA_FILE_NOT_FOUND';
    public const MEDIA_MISSING_FILE = 'CONTENT__MEDIA_MISSING_FILE';
    public const MEDIA_NOT_FOUND = 'CONTENT__MEDIA_NOT_FOUND';
    public const MEDIA_DUPLICATED_FILE_NAME = 'CONTENT__MEDIA_DUPLICATED_FILE_NAME';

    public static function invalidContentLength(): self
    {
        if (!Feature::isActive('v6.6.0.0')) {
            return new UploadException('Expected content-length did not match actual size.');
        }

        return new self(
            Response::HTTP_BAD_REQUEST,
            self::MEDIA_INVALID_CONTENT_LENGTH,
            'Expected content-length did not match actual size.'
        );
    }

    public static function invalidUrl(string $url): self
    {
return OrderTransactionCaptureRefundCollection::class;
    }

    protected function getParentDefinitionClass(): ?string
    {
        return OrderTransactionCaptureDefinition::class;
    }

    protected function defineFields(): FieldCollection
    {
        // @deprecated tag:v6.6.0 - Variable $autoload will be removed in the next major as it will be false by default         $autoload = !Feature::isActive('v6.6.0.0');

        return new FieldCollection([
            (new IdField('id', 'id'))->addFlags(new ApiAware()new PrimaryKey()new Required()),
            (new VersionField())->addFlags(new ApiAware()),
            (new FkField('capture_id', 'captureId', OrderTransactionCaptureDefinition::class))->addFlags(new ApiAware()new Required()),
            (new ReferenceVersionField(OrderTransactionCaptureDefinition::class, 'capture_version_id'))->addFlags(new ApiAware()new Required()),
            (new StateMachineStateField('state_id', 'stateId', OrderTransactionCaptureRefundStates::STATE_MACHINE))->addFlags(new ApiAware()new Required()),
            (new ManyToOneAssociationField('stateMachineState', 'state_id', StateMachineStateDefinition::class, 'id', $autoload))->addFlags(new ApiAware()),
            (new ManyToOneAssociationField('transactionCapture', 'capture_id', OrderTransactionCaptureDefinition::class, 'id'))->addFlags(new ApiAware()),
            (new OneToManyAssociationField('positions', OrderTransactionCaptureRefundPositionDefinition::class, 'refund_id'))->addFlags(new ApiAware()new CascadeDelete()),

            (
$listener->assertSent('order_confirmation_mail');

            return $orderId;
        });

        $item = $this->assertProductInOrder($orderId$product->id);

        static::assertEquals(100, $item->getUnitPrice());

        static::assertEquals(100, $item->getTotalPrice());

        if (Feature::isActive('STOCK_HANDLING')) {
            $this->assertStock($product->id, 99, 99);
        } else {
            $this->assertStock($product->id, 100, 99);
        }
    }
}
$commandTester->execute(['name' => $appName]);

        static::assertEquals(0, $commandTester->getStatusCode());

        static::assertStringContainsString('[OK] App activated successfully.', $commandTester->getDisplay());

        $criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('name', $appName));

        $app = $this->appRepository->search($criteria, Context::createDefaultContext())->first();

        static::assertTrue($app->isActive());
    }

    public function testActivateNonExistingAppFails(): void
    {
        $commandTester = new CommandTester($this->getContainer()->get(ActivateAppCommand::class));

        $appName = 'NonExisting';
        $commandTester->execute(['name' => $appName]);

        static::assertEquals(1, $commandTester->getStatusCode());

        

        $paymentMethodId = $this->getPaymentMethodId('prepared');
        $cart = Generator::createCart();
        $customerId = $this->createCustomer();
        $salesChannelContext = $this->getSalesChannelContext($paymentMethodId$customerId);

        $response = (new ValidateResponse())->assign([
            'message' => self::ERROR_MESSAGE,
        ]);
        $this->appendNewResponse($this->signResponse($response->jsonSerialize()));

        if (!Feature::isActive('v6.6.0.0')) {
            $this->expectException(ValidatePreparedPaymentException::class);
        }
        $this->expectException(PaymentException::class);
        $this->expectExceptionMessageMatches(sprintf('/%s/', self::ERROR_MESSAGE));
        $this->preparedPaymentService->handlePreOrderPayment($cartnew RequestDataBag()$salesChannelContext);
    }

    public function testValidateWithUnsignedResponse(): void
    {
        $paymentMethodId = $this->getPaymentMethodId('prepared');
        $cart = Generator::createCart();
        
static::assertEquals(1, $intField->getMax());
        static::assertEquals(['en-GB' => 'Enter an int...']$intField->getPlaceholder());
        static::assertTrue($intField->getRequired());
    }

    public function testToEntityArray(): void
    {
        $intField = $this->importCustomField(__DIR__ . '/_fixtures/int-field.xml');

        static::assertEquals('test_int_field', $intField->getName());
        static::assertEquals('int', $intField->getType());
        static::assertTrue($intField->isActive());
        static::assertEquals([
            'type' => 'number',
            'label' => [
                'en-GB' => 'Test int field',
                'de-DE' => 'Test Ganzzahlenfeld',
            ],
            'helpText' => [
                'en-GB' => 'This is an int field.',
            ],
            'placeholder' => [
                'en-GB' => 'Enter an int...',
            ],
use PHPUnit\Framework\TestCase;
use Shopware\Core\Framework\App\Flow\Action\Action;
use Shopware\Core\Framework\Feature;

/** * @internal */
class ConfigTest extends TestCase
{
    public function testFromXml(): void
    {
        $flowActionsFile = Feature::isActive('v6.6.0.0') ? '/../_fixtures/valid/major/flow.xml' : '/../_fixtures/valid/minor/flow-action.xml';
        $flowActions = Action::createFromXmlFile(__DIR__ . $flowActionsFile);
        static::assertNotNull($flowActions->getActions());

        static::assertCount(1, $flowActions->getActions()->getActions());
        static::assertCount(4, $flowActions->getActions()->getActions()[0]->getConfig()->getConfig());
    }
}
self::LOCALE_DOES_NOT_EXISTS_EXCEPTION,
            'The locale {{ locale }} does not exists.',
            ['locale' => $locale]
        );
    }

    /** * @deprecated tag:v6.6.0 - reason:return-type-change - will return `self` in the future */
    public static function languageNotFound(?string $languageId): HttpException
    {
        if (!Feature::isActive('v6.6.0.0')) {
            return new LanguageNotFoundException($languageId);
        }

        return new self(
            Response::HTTP_PRECONDITION_FAILED,
            self::LANGUAGE_NOT_FOUND,
            'The language "{{ languageId }}" was not found.',
            ['languageId' => $languageId]
        );
    }
}
'errorCode' => SalesChannelException::CURRENCY_DOES_NOT_EXISTS_EXCEPTION,
            'message' => 'Currency with id "myCustomCurrency" not found!.',
        ];

        yield SalesChannelException::LANGUAGE_NOT_FOUND => [
            'exception' => SalesChannelException::languageNotFound('myCustomLanguage'),
            'statusCode' => Response::HTTP_PRECONDITION_FAILED,
            'errorCode' => SalesChannelException::LANGUAGE_NOT_FOUND,
            'message' => 'The language "myCustomLanguage" was not found.',
        ];

        if (!Feature::isActive('v6.6.0.0')) {
            yield 'payment method not found exception' => [
                'exception' => SalesChannelException::unknownPaymentMethod('myCustomPaymentMethod'),
                'statusCode' => Response::HTTP_NOT_FOUND,
                'errorCode' => 'CHECKOUT__UNKNOWN_PAYMENT_METHOD',
                'message' => 'The payment method myCustomPaymentMethod could not be found.',
            ];
        } else {
            yield 'payment method not found exception' => [
                'exception' => SalesChannelException::unknownPaymentMethod('myCustomPaymentMethod'),
                'statusCode' => Response::HTTP_BAD_REQUEST,
                'errorCode' => 'CHECKOUT__UNKNOWN_PAYMENT_METHOD',
                
Home | Imprint | This part of the site doesn't use cookies.