public function DateTimePlusTest::testChainableNonCallable in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testChainableNonCallable()
- 10 core/tests/Drupal/Tests/Component/Datetime/DateTimePlusTest.php \Drupal\Tests\Component\Datetime\DateTimePlusTest::testChainableNonCallable()
Tests that chained calls to non-existent functions throw an exception.
@covers ::__call
File
- core/
tests/ Drupal/ Tests/ Component/ Datetime/ DateTimePlusTest.php, line 903
Class
- DateTimePlusTest
- @coversDefaultClass \Drupal\Component\Datetime\DateTimePlus @group Datetime
Namespace
Drupal\Tests\Component\DatetimeCode
public function testChainableNonCallable() {
$this
->expectException(\BadMethodCallException::class);
$this
->expectExceptionMessage('Call to undefined method Drupal\\Component\\Datetime\\DateTimePlus::nonexistent()');
$date = new DateTimePlus('now', 'Australia/Sydney');
$date
->setTimezone(new \DateTimeZone('America/New_York'))
->nonexistent();
}