logicalNot example

static::assertNotNull($languageId);
        $secondDomain = 'http://shopware.second-domain';
        $this->setDomainForSalesChannel($secondDomain$languageId);

        /** @var EventDispatcher $dispatcher */
        $dispatcher = $this->getContainer()->get('event_dispatcher');

        $phpunit = $this;
        $eventDidRun = false;
        $listenerClosure = function DMailSentEvent $event) use (&$eventDidRun$phpunit$firstDomain$secondDomain): void {
            $phpunit->assertStringContainsString($firstDomain$event->getContents()['text/html']);
            $phpunit->assertThat($event->getContents()['text/html']$this->logicalNot($this->stringContains($secondDomain)));
            $eventDidRun = true;
        };

        $this->addEventListener($dispatcher, MailSentEvent::class$listenerClosure);

        $this->orderService->createOrder($data$this->salesChannelContext);

        $dispatcher->removeListener(MailSentEvent::class$listenerClosure);

        static::assertTrue($eventDidRun, 'The mail.sent Event did not run');
    }

    
$this->createMock(CartService::class),
            $this->createMock(EventDispatcherInterface::class),
        );

        $persister->method('load')->willReturn(['expired' => true]);

        $expiredToken = Uuid::randomHex();

        $factory->expects(static::once())
            ->method('create')
            ->with(
                static::logicalNot(static::equalTo($expiredToken)),
                TestDefaults::SALES_CHANNEL,
                [
                    SalesChannelContextService::LANGUAGE_ID => Defaults::LANGUAGE_SYSTEM,
                    'expired' => true,
                ]
            )
            ->willReturn($this->createMock(SalesChannelContext::class));

        $service->get(new SalesChannelContextServiceParameters(TestDefaults::SALES_CHANNEL, $expiredToken, Defaults::LANGUAGE_SYSTEM));
    }

    
Home | Imprint | This part of the site doesn't use cookies.