You are here

public function BambooTwigExtensionsTest::testDateDiffTimeInAuto in Bamboo Twig 8.4

Same name and namespace in other branches
  1. 8.5 tests/src/Functional/BambooTwigExtensionsTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigExtensionsTest::testDateDiffTimeInAuto()
  2. 8.2 tests/src/Functional/BambooTwigExtensionsTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigExtensionsTest::testDateDiffTimeInAuto()
  3. 8.3 tests/src/Functional/BambooTwigExtensionsTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigExtensionsTest::testDateDiffTimeInAuto()

Cover the \Twig_Extensions_Extension_Date::diff.

File

tests/src/Functional/BambooTwigExtensionsTest.php, line 88

Class

BambooTwigExtensionsTest
Tests Extensions twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

public function testDateDiffTimeInAuto() {
  $this
    ->drupalGet('/bamboo-twig-extensions');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-1', 'in 1 second');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-2', 'in 5 seconds');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-3', 'in 1 minute');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-4', 'in 5 minutes');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-5', 'in 1 hour');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-6', 'in 9 hours');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-7', 'in 1 day');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-8', 'in 5 days');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-9', 'in 1 month');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-10', 'in 6 months');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-11', 'in 1 year');
  $this
    ->assertElementContains('.test-extensions div.date-diff-in-12', 'in 3 years');
}