LogicalNot example


        self::assertThat(self::getMessageMailerEvents()new MailerConstraint\EmailCount($count$transport, true)$message);
    }

    public static function assertEmailIsQueued(MessageEvent $event, string $message = ''): void
    {
        self::assertThat($eventnew MailerConstraint\EmailIsQueued()$message);
    }

    public static function assertEmailIsNotQueued(MessageEvent $event, string $message = ''): void
    {
        self::assertThat($eventnew LogicalNot(new MailerConstraint\EmailIsQueued())$message);
    }

    public static function assertEmailAttachmentCount(RawMessage $email, int $count, string $message = ''): void
    {
        self::assertThat($emailnew MimeConstraint\EmailAttachmentCount($count)$message);
    }

    public static function assertEmailTextBodyContains(RawMessage $email, string $text, string $message = ''): void
    {
        self::assertThat($emailnew MimeConstraint\EmailTextBodyContains($text)$message);
    }

    

trait DomCrawlerAssertionsTrait
{
    public static function assertSelectorExists(string $selector, string $message = ''): void
    {
        self::assertThat(self::getCrawler()new DomCrawlerConstraint\CrawlerSelectorExists($selector)$message);
    }

    public static function assertSelectorNotExists(string $selector, string $message = ''): void
    {
        self::assertThat(self::getCrawler()new LogicalNot(new DomCrawlerConstraint\CrawlerSelectorExists($selector))$message);
    }

    public static function assertSelectorCount(int $expectedCount, string $selector, string $message = ''): void
    {
        self::assertThat(self::getCrawler()new DomCrawlerConstraint\CrawlerSelectorCount($expectedCount$selector)$message);
    }

    public static function assertSelectorTextContains(string $selector, string $text, string $message = ''): void
    {
        self::assertThat(self::getCrawler(), LogicalAnd::fromConstraints(
            new DomCrawlerConstraint\CrawlerSelectorExists($selector),
            

  public function statusMessageExistsAfterWait(string $type = NULL, int $timeout = 10000): void {
    $selector = $this->buildJavascriptStatusMessageSelector(NULL, $type);
    $status_message_element = $this->waitForElement('xpath', $selector$timeout);
    if ($type) {
      $failure_message = sprintf('A status message of type "%s" does not appear on this page, but it should.', $type);
    }
    else {
      $failure_message = 'A status message does not appear on this page, but it should.';
    }
    // There is no Assert::isNotNull() method, so we make our own constraint.     $constraint = new LogicalNot(new IsNull());
    Assert::assertThat($status_message_element$constraint$failure_message);
  }

  /** * Asserts that a status message does not exist after wait. * * @param string|null $type * The optional message type: status, error, or warning. * @param int $timeout * Optional timeout in milliseconds, defaults to 10000. */
  

  public function responseHeaderDoesNotExist(string $name, string $message = ''): void {
    if ($message === '') {
      $message = "Failed asserting that the response does not have a '$name' header.";
    }
    $headers = $this->session->getResponseHeaders();
    $constraint = new LogicalNot(
      new ArrayHasKey($name)
    );
    Assert::assertThat($headers$constraint$message);
  }

  /** * Asserts that the current page text matches regex a number of times. * * @param int $count * The number of times the pattern is expected to be present. * @param string $regex * The regex pattern. * @param string $message * (Optional) the failure message. */
self::assertThatForResponse($constraint$message);
    }

    public static function assertResponseHasHeader(string $headerName, string $message = ''): void
    {
        self::assertThatForResponse(new ResponseConstraint\ResponseHasHeader($headerName)$message);
    }

    public static function assertResponseNotHasHeader(string $headerName, string $message = ''): void
    {
        self::assertThatForResponse(new LogicalNot(new ResponseConstraint\ResponseHasHeader($headerName))$message);
    }

    public static function assertResponseHeaderSame(string $headerName, string $expectedValue, string $message = ''): void
    {
        self::assertThatForResponse(new ResponseConstraint\ResponseHeaderSame($headerName$expectedValue)$message);
    }

    public static function assertResponseHeaderNotSame(string $headerName, string $expectedValue, string $message = ''): void
    {
        self::assertThatForResponse(new LogicalNot(new ResponseConstraint\ResponseHeaderSame($headerName$expectedValue))$message);
    }

    
static::assertThat($haystack$constraint$message);
    }

    /** * @param iterable $haystack * @param string $message * * @return void */
    public static function assertNotContainsEquals($needle$haystack$message = '')
    {
        $constraint = new LogicalNot(new TraversableContains($needle, false, false));
        static::assertThat($haystack$constraint$message);
    }

    /** * @param string $filename * @param string $message * * @return void */
    public static function assertIsNotReadable($filename$message = '')
    {
        

        self::assertThat(self::getMessageMailerEvents()new NotifierConstraint\NotificationCount($count$transportName, true)$message);
    }

    public static function assertNotificationIsQueued(MessageEvent $event, string $message = ''): void
    {
        self::assertThat($eventnew NotifierConstraint\NotificationIsQueued()$message);
    }

    public static function assertNotificationIsNotQueued(MessageEvent $event, string $message = ''): void
    {
        self::assertThat($eventnew LogicalNot(new NotifierConstraint\NotificationIsQueued())$message);
    }

    public static function assertNotificationSubjectContains(MessageInterface $notification, string $text, string $message = ''): void
    {
        self::assertThat($notificationnew NotifierConstraint\NotificationSubjectContains($text)$message);
    }

    public static function assertNotificationSubjectNotContains(MessageInterface $notification, string $text, string $message = ''): void
    {
        self::assertThat($notificationnew LogicalNot(new NotifierConstraint\NotificationSubjectContains($text))$message);
    }

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