public function BambooTwigExtensionsTest::testDateDiffTimeAgoForcedUnit in Bamboo Twig 8.2
Same name and namespace in other branches
- 8.5 tests/src/Functional/BambooTwigExtensionsTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigExtensionsTest::testDateDiffTimeAgoForcedUnit()
- 8.3 tests/src/Functional/BambooTwigExtensionsTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigExtensionsTest::testDateDiffTimeAgoForcedUnit()
- 8.4 tests/src/Functional/BambooTwigExtensionsTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigExtensionsTest::testDateDiffTimeAgoForcedUnit()
Cover the \Twig_Extensions_Extension_Date::diff.
File
- tests/
src/ Functional/ BambooTwigExtensionsTest.php, line 108
Class
- BambooTwigExtensionsTest
- Tests Configs twig filters and functions.
Namespace
Drupal\Tests\bamboo_twig\FunctionalCode
public function testDateDiffTimeAgoForcedUnit() {
$this
->drupalGet('/bamboo-twig-extensions');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-1', '1 second ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-2', '0.016666666666667 minute ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-3', '5 seconds ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-4', '60 seconds ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-5', '1 minute ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-6', '302 seconds ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-7', '3660 seconds ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-8', '32702 seconds ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-9', '0.76666666666667 day ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-10', '4.7666666666667 days ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-11', '30.766666666667 days ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-12', '1.2833333333333 month ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-13', '6.35 months ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-14', '391.76666666667 days ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-15', '37.65 months ago');
$this
->assertElementContains('.test-extensions div.date-diff-unit-ago-16', '3.3218685831622 years ago');
}