setActive example

$payment->setName($data['__payment_name']);
        $payment->setDescription($data['__payment_description']);
        $payment->setTemplate($data['__payment_template']);
        $payment->setClass($data['__payment_class']);
        $payment->setTable($data['__payment_table']);
        $payment->setHide($data['__payment_hide']);
        $payment->setAdditionalDescription(isset($data['__payment_additionalDescription']) ? $data['__payment_additionalDescription'] : $data['__payment_additionaldescription']);
        $payment->setDebitPercent($data['__payment_debit_percent']);
        $payment->setSurcharge($data['__payment_surcharge']);
        $payment->setSurchargeString($data['__payment_surchargestring']);
        $payment->setPosition($data['__payment_position']);
        $payment->setActive($data['__payment_active']);
        $payment->setEsdActive($data['__payment_esdactive']);
        $payment->setEmbediframe($data['__payment_embediframe']);
        $payment->setHideProspect($data['__payment_hideprospect']);
        $payment->setAction($data['__payment_action']);
        $payment->setPluginID($data['__payment_pluginID']);
        $payment->setSource($data['__payment_source']);
        $payment->setMobileInactive($data['__payment_mobile_inactive']);

        if (isset($data['__paymentAttribute_id'])) {
            $this->attributeHydrator->addAttribute($payment$data, 'paymentAttribute');
        }

        
$this->attributeHydrator = $attributeHydrator;
    }

    /** * @return Emotion */
    public function hydrate(array $data)
    {
        $emotion = new Emotion();

        $emotion->setId((int) $data['__emotion_id']);
        $emotion->setActive((bool) $data['__emotion_active']);
        $emotion->setName($data['__emotion_name']);
        $emotion->setCols((int) $data['__emotion_cols']);
        $emotion->setCellSpacing((int) $data['__emotion_cell_spacing']);
        $emotion->setCellHeight((int) $data['__emotion_cell_height']);
        $emotion->setArticleHeight((int) $data['__emotion_article_height']);
        $emotion->setRows((int) $data['__emotion_rows']);
        $emotion->setValidFrom($this->createDate($data['__emotion_valid_from']));
        $emotion->setValidTo($this->createDate($data['__emotion_valid_to']));
        $emotion->setUserId((int) $data['__emotion_user_id']);
        $emotion->setShowListing((bool) $data['__emotion_show_listing']);
        $emotion->setIsLandingPage((bool) $data['__emotion_is_landingpage']);
        

    public function getInput(): EntityCollection|Entity
    {
        $userId = '6f51622eb3814c75ae0263cece27ce72';

        $user = new UserEntity();
        $user->setId($userId);
        $user->setFirstName('Manufacturer');
        $user->setLastName('');
        $user->setPassword('password');
        $user->setUsername('user1');
        $user->setActive(true);
        $user->setAdmin(true);
        $user->setEmail('user1@shop.de');
        $user->setCreatedAt(new \DateTime('2018-01-15T08:01:16.000+00:00'));
        $user->internalSetEntityData('user', new FieldVisibility([]));

        $media = new MediaEntity();
        $media->setId('548faa1f7846436c85944f4aea792d96');
        $media->setUserId($userId);
        $media->setMimeType('image/jpg');
        $media->setFileExtension('jpg');
        $media->setFileSize(93889);
        


        static::expectException(ConstraintViolationException::class);
        $this->route->confirm($this->mockRequestDataBag()$this->context);
    }

    public function testConfirmActivatedCustomer(): void
    {
        Feature::skipTestIfActive('v6.6.0.0', $this);

        $customer = $this->mockCustomer();
        $customer->setActive(true);

        $this->customerRepository->expects(static::once())
            ->method('search')
            ->willReturn(
                new EntitySearchResult(
                    'customer',
                    1,
                    new CustomerCollection([$customer]),
                    null,
                    new Criteria(),
                    $this->context->getContext()
                )
/** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        /** @var EsBackendIndexer $indexer */
        $indexer = $this->container->get('shopware_es_backend.indexer');

        $helper = new ConsoleProgressHelper($output);
        $evaluation = $this->container->get(\Shopware\Bundle\ESIndexingBundle\Console\EvaluationHelperInterface::class);
        $evaluation->setOutput($output)
            ->setActive(!$input->getOption('no-evaluation'))
            ->setStopOnError($input->getOption('stop-on-error'));

        $indexer->index($helper);

        return 0;
    }
}

    public function prepareHttpCacheConfigForSaving(array $data)
    {
        trigger_error(sprintf('%s:%s is deprecated since Shopware 5.6 and will be private with 5.8.', __CLASS__, __METHOD__), E_USER_DEPRECATED);

        $modelManager = $this->container->get(ModelManager::class);
        $repo = $modelManager->getRepository(Plugin::class);

        /** @var Plugin $plugin */
        $plugin = $repo->findOneBy(['name' => 'HttpCache']);
        $plugin->setActive($data['enabled']);

        $modelManager->flush($plugin);

        $lines = [];
        foreach ($data['cacheControllers'] as $entry) {
            $lines[] = $entry['key'] . ' ' . $entry['value'];
        }
        $data['cacheControllers'] = implode("\n", $lines);

        $lines = [];
        foreach ($data['noCacheControllers'] as $entry) {
            
static::assertSame(Command::SUCCESS, $tester->execute(['--skip-asset-build' => true]));

        static::assertSame('Updated plugin Test2 from version 1.0.0 to version 1.0.1', trim($tester->getDisplay()));
    }

    private function createPlugin(string $name, bool $active = true, ?string $upgradeVersion = null): PluginEntity
    {
        $plugin = new PluginEntity();
        $plugin->setId(Uuid::randomHex());
        $plugin->setName($name);
        $plugin->setVersion('1.0.0');
        $plugin->setActive($active);
        $plugin->setUpgradeVersion($upgradeVersion);

        return $plugin;
    }
}
'createdAt' => new \DateTimeImmutable('2019-01-01'),
            'managedByComposer' => false,
        ]);
        $plugin->setInstalledAt(new \DateTimeImmutable());

        return $plugin;
    }

    protected function getActivePlugin(): PluginEntity
    {
        $active = $this->getInstalledInactivePlugin();
        $active->setActive(true);

        return $active;
    }

    protected function getActivePluginWithBundle(): PluginEntity
    {
        $plugin = new PluginEntity();
        $plugin->assign([
            'id' => Uuid::randomHex(),
            'name' => 'SwagTestWithBundle',
            'baseClass' => SwagTestWithBundle::class,
            
public function testProcess(): void
    {
        $cart = $this->createCart();
        $salesChannelContext = static::createMock(SalesChannelContext::class);
        $salesChannelContext
            ->method('getTotalRounding')
            ->willReturn(new CashRoundingConfig(2, 0.01, true));

        $taxProvider = new TaxProviderEntity();
        $taxProvider->setId(Uuid::randomHex());
        $taxProvider->setActive(true);
        $taxProvider->setPriority(1);
        $taxProvider->setIdentifier(TestConstantTaxRateProvider::class);

        $collection = new TaxProviderCollection([$taxProvider]);

        $result = new EntitySearchResult(
            TaxProviderDefinition::ENTITY_NAME,
            1,
            $collection,
            null,
            new Criteria(),
            


        $extensionStructs = $pluginCompatibility->getExtensionsToDeactivate(new Version(), Context::createDefaultContext());

        static::assertCount(0, $extensionStructs);
    }

    public function getExtensionDataProvider(): AbstractExtensionDataProvider&MockObject
    {
        $extension = new ExtensionStruct();
        $extension->setName('TestApp');
        $extension->setActive(true);

        $extensionDataProvider = $this->createMock(AbstractExtensionDataProvider::class);
        $extensionDataProvider
            ->method('getInstalledExtensions')
            ->willReturn(new ExtensionCollection(['TestApp' => $extension]));

        return $extensionDataProvider;
    }

    public function getStoreClient(string $file = __DIR__ . './../_fixtures/responses/extension-red.json'): StoreClient&MockObject
    {
        
public function activatePlugin(Plugin $plugin)
    {
        $bootstrap = $this->getPluginBootstrap($plugin);

        $result = $bootstrap->enable();
        $result = \is_bool($result) ? ['success' => $result] : $result;

        if ($result['success'] == false) {
            throw new Exception(sprintf('Not allowed to enable plugin "%s".', $plugin->getName()));
        }

        $plugin->setActive(true);
        $plugin->setInSafeMode(false);
        $this->em->flush($plugin);

        return $result;
    }

    /** * @throws \Doctrine\ORM\OptimisticLockException * * @return array */
    
$this->assertEquals($expected_weight$this->localTaskBase->getWeight());
  }

  /** * @covers ::getActive * @covers ::setActive */
  public function testActive() {
    $this->setupLocalTaskDefault();

    $this->assertFalse($this->localTaskBase->getActive());
    $this->localTaskBase->setActive();
    $this->assertTrue($this->localTaskBase->getActive());
  }

  /** * @covers ::getTitle */
  public function testGetTitle() {
    $this->pluginDefinition['title'] = (new TranslatableMarkup('Example', [][]$this->stringTranslation));
    $this->stringTranslation->expects($this->once())
      ->method('translateString')
      ->with($this->pluginDefinition['title'])
      
$context = new UninstallContext($plugin$this->release->getVersion()$plugin->getVersion(), !$removeData);
        $bootstrap = $this->getPluginByName($plugin->getName());

        $this->events->notify(PluginEvent::PRE_DEACTIVATE, new PrePluginDeactivateEvent($context$bootstrap));
        $this->events->notify(PluginEvent::PRE_UNINSTALL, new PrePluginUninstallEvent($context$bootstrap));

        $this->applyMigrations($bootstrap, AbstractPluginMigration::MODUS_UNINSTALL, !$removeData);

        $bootstrap->uninstall($context);

        $plugin->setInstalled(null);
        $plugin->setActive(false);

        $this->events->notify(PluginEvent::POST_UNINSTALL, new PostPluginUninstallEvent($context$bootstrap));
        $this->events->notify(PluginEvent::POST_DEACTIVATE, new PostPluginDeactivateEvent($context$bootstrap));

        $this->em->flush($plugin);

        $pluginId = $plugin->getId();

        $this->removeEventSubscribers($pluginId);
        $this->removeCrontabEntries($pluginId);
        $this->removeMenuEntries($pluginId);
        

    public function testValidateRule(
        bool $isActive,
        bool $customerActiveValue,
        bool $expectedValue,
        bool $noCustomer
    ): void {
        $salesChannelContext = $this->createMock(SalesChannelContext::class);

        if (!$noCustomer) {
            $customer = new CustomerEntity();
            $customer->setActive($customerActiveValue);

            $salesChannelContext
                ->method('getCustomer')
                ->willReturn($customer);
        }

        $isActiveCustomerRule = new IsActiveRule($isActive);

        $scope = new CheckoutRuleScope($salesChannelContext);

        static::assertSame($expectedValue$isActiveCustomerRule->match($scope));
    }

    public function hydrate(array $data)
    {
        $translation = $this->getBlogTranslation($data);
        $data = array_merge($data$translation);

        $blog = new Blog();

        $blog->setId((int) $data['__blog_id']);
        $blog->setTitle($data['__blog_title']);
        $blog->setAuthorId($data['__blog_author_id'] !== null ? (int) $data['__blog_author_id'] : null);
        $blog->setActive((bool) $data['__blog_active']);
        $blog->setShortDescription($data['__blog_short_description']);
        $blog->setDescription($data['__blog_description']);
        $blog->setViews((int) $data['__blog_views']);
        $blog->setDisplayDate($data['__blog_display_date'] ? date_create($data['__blog_display_date']) : null);
        $blog->setCategoryId((int) $data['__blog_category_id']);
        $blog->setTemplate($data['__blog_template']);
        $blog->setMetaKeywords($data['__blog_meta_keywords']);
        $blog->setMetaDescription($data['__blog_meta_description']);
        $blog->setMetaTitle($data['__blog_meta_title']);

        if (isset($data['__blogAttribute_id'])) {
            
Home | Imprint | This part of the site doesn't use cookies.