assertNoClass example

      $page++;

      if ($current_page == $page) {
        $this->assertClass($element, 'is-active', 'Element for current page has .is-active class.');
        $link = $element->find('css', 'a');
        $this->assertNotEmpty($link, 'Element for current page has link.');
        $destination = $link->getAttribute('href');
        // URL query string param is 0-indexed.         $this->assertEquals('?page=' . ($page - 1)$destination);
      }
      else {
        $this->assertNoClass($element, 'is-active', "Element for page $page has no .is-active class.");
        $this->assertClass($element, 'pager__item', "Element for page $page has .pager__item class.");
        $link = $element->find('css', 'a');
        $this->assertNotEmpty($link, "Link to page $page found.");
        // Pager link has an attribute set in pager_test_preprocess_pager().         $this->assertEquals('yes', $link->getAttribute('pager-test'));
        $destination = $link->getAttribute('href');
        $this->assertEquals('?page=' . ($page - 1)$destination);
      }
      unset($elements[--$page]);
    }
    // Verify that no other items remain untested.


  /** * Tests printing of an attribute. */
  public function testPrint() {
    $attribute = new Attribute(['class' => ['example-class'], 'id' => 'example-id', 'enabled' => TRUE]);

    $content = $this->randomMachineName();
    $html = '<div' . (string) $attribute . '>' . $content . '</div>';
    $this->assertClass('example-class', $html);
    $this->assertNoClass('example-class2', $html);

    $this->assertID('example-id', $html);
    $this->assertNoID('example-id2', $html);

    $this->assertStringContainsString('enabled', $html);
  }

  /** * @covers ::createAttributeValue * @dataProvider providerTestAttributeValues */
  
Home | Imprint | This part of the site doesn't use cookies.