You are here

public function BambooTwigExtensionsTest::testDateDiffTimeAgoAuto in Bamboo Twig 8.3

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

Cover the \Twig_Extensions_Extension_Date::diff.

File

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

Class

BambooTwigExtensionsTest
Tests Extensions twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

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