setPriority example



    /** * {@inheritdoc} */
    public function getUrls(SalesChannelContext $context, int $limit, ?int $offset = null): UrlResult
    {
        $homepageUrl = new Url();
        $homepageUrl->setLoc('');
        $homepageUrl->setLastmod(new \DateTime());
        $homepageUrl->setChangefreq(self::CHANGE_FREQ);
        $homepageUrl->setPriority(self::PRIORITY);
        $homepageUrl->setResource($this->getName());
        $homepageUrl->setIdentifier('');

        return new UrlResult([$homepageUrl], null);
    }
}
/** * @author Mickael Perraud <mikaelkael.fr@gmail.com> */
class NtfyOptionsTest extends TestCase
{
    public function testNtfyOptions()
    {
        $delay = (new \DateTime())->add(new \DateInterval('PT1M'));
        $ntfyOptions = (new NtfyOptions())
            ->setMessage('test message')
            ->setTitle('message title')
            ->setPriority(NtfyOptions::PRIORITY_URGENT)
            ->setTags(['tag1', 'tag2'])
            ->addTag('tag3')
            ->setDelay($delay)
            ->setActions([['action' => 'view', 'label' => 'View', 'url' => 'https://test.com']])
            ->addAction(['action' => 'http', 'label' => 'Open', 'url' => 'https://test2.com'])
            ->setClick('https://test3.com')
            ->setAttachment('https://filesrv.lan/space.jpg')
            ->setFilename('diskspace.jpg')
            ->setEmail('me@mail.com')
            ->setCache(false)
            ->setFirebase(false)
        ;

        $ruleId = Uuid::randomHex();

        $salesChannelContext = $this->createMock(SalesChannelContext::class);
        $context = new Context(new SystemSource()[$ruleId]);
        $salesChannelContext->method('getContext')->willReturn($context);
        $event = new SalesChannelContextResolvedEvent($salesChannelContext, Uuid::randomHex());

        $activeRule = new RuleEntity();
        $activeRule->setId($ruleId);
        $activeRule->setName('Demo rule');
        $activeRule->setPriority(100);

        $ruleRepository = $this->createMock(EntityRepository::class);
        $ruleRepository
            ->method('search')
            ->willReturn(new EntitySearchResult(
                'rule',
                1,
                new RuleCollection([$activeRule]),
                null,
                new Criteria(),
                Context::createDefaultContext()
            ));
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(),
            Context::createDefaultContext()
        );
public function setTitle(string $title): self
    {
        $this->options['title'] = $title;

        return $this;
    }

    public function setStringPriority(string $priority): self
    {
        switch ($priority) {
            case Notification::IMPORTANCE_URGENT:
                return $this->setPriority(self::PRIORITY_URGENT);
            case Notification::IMPORTANCE_HIGH:
                return $this->setPriority(self::PRIORITY_HIGH);
            case Notification::IMPORTANCE_LOW:
                return $this->setPriority(self::PRIORITY_LOW);
            default:
                return $this->setPriority(self::PRIORITY_DEFAULT);
        }
    }

    public function setPriority(int $priority): self
    {
        
Home | Imprint | This part of the site doesn't use cookies.