You are here

public function BambooTwigExtensionsTest::testDateDiffTimeInForcedUnit in Bamboo Twig 8.2

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

Cover the \Twig_Extensions_Extension_Date::diff.

File

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

Class

BambooTwigExtensionsTest
Tests Configs twig filters and functions.

Namespace

Drupal\Tests\bamboo_twig\Functional

Code

public function testDateDiffTimeInForcedUnit() {
  $this
    ->drupalGet('/bamboo-twig-extensions');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-1', 'in 1 second');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-2', 'in 5 seconds');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-3', 'in 1 minute');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-4', 'in 302 seconds');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-5', 'in 61 minutes');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-6', 'in 32702 seconds');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-7', 'in 1 day');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-8', 'in 0.16666666666667 month');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-9', 'in 1.0666666666667 month');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-10', 'in 189 days');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-11', 'in 13.233333333333 months');
  $this
    ->assertElementContains('.test-extensions div.date-diff-unit-in-12', 'in 3.088295687885 years');
}