Commit f6e4b88f authored by xjm's avatar xjm
Browse files

Issue #3131817 by quietone, Suresh Prabhu Parkala, jungle, mondrake, daffie,...

Issue #3131817 by quietone, Suresh Prabhu Parkala, jungle, mondrake, daffie, catch, xjm: Replace assertions involving calls to is_numeric() with assertIsNumeric()/assertIsNotNumeric()
parent 7b1f3e11
......@@ -39,7 +39,7 @@ public function testAggregatorFeedImport() {
// The feed's last checked time can change as the fixture is updated, so
// assert that its format is correct.
$checked_time = $feed->getLastCheckedTime();
$this->assertTrue(is_numeric($checked_time));
$this->assertIsNumeric($checked_time);
$this->assertTrue($checked_time > 1000000000);
$this->assertIdentical('0', $feed->getQueuedTime());
$this->assertIdentical('http://knowyourmeme.com', $feed->link->value);
......
......@@ -81,8 +81,8 @@ public function testRevisions() {
]));
if ($delta > 0) {
$this->assertInstanceOf(UserInterface::class, $loaded->getRevisionUser());
$this->assertTrue(is_numeric($loaded->getRevisionUserId()), 'Revision User ID found.');
$this->assertTrue(is_numeric($loaded->getRevisionCreationTime()), 'Revision time found.');
$this->assertIsNumeric($loaded->getRevisionUserId());
$this->assertIsNumeric($loaded->getRevisionCreationTime());
}
}
......
......@@ -119,7 +119,7 @@ public function testHistory() {
$response = $this->markNodeAsRead($nid);
$this->assertEquals(200, $response->getStatusCode());
$timestamp = Json::decode($response->getBody());
$this->assertTrue(is_numeric($timestamp), 'Node has been marked as read. Timestamp received.');
$this->assertIsNumeric($timestamp);
// Retrieve "last read" timestamp for test node, for the current user.
$response = $this->getNodeReadTimestamps([$nid]);
......
......@@ -286,7 +286,8 @@ public function testModuleMetaData() {
// Use 0 if mtime isn't present, to avoid an array index notice.
$test_mtime = !empty($modules['system']->info['mtime']) ? $modules['system']->info['mtime'] : 0;
// Ensure the mtime field contains a number that is greater than zero.
$this->assertTrue(is_numeric($test_mtime) && ($test_mtime > 0), 'The system.info.yml file modification time field contains a timestamp.');
$this->assertIsNumeric($test_mtime);
$this->assertGreaterThan(0, $test_mtime);
}
/**
......@@ -317,7 +318,8 @@ public function testThemeMetaData() {
// Use 0 if mtime isn't present, to avoid an array index notice.
$test_mtime = !empty($themes['bartik']->info['mtime']) ? $themes['bartik']->info['mtime'] : 0;
// Ensure the mtime field contains a number that is greater than zero.
$this->assertTrue(is_numeric($test_mtime) && ($test_mtime > 0), 'The bartik.info.yml file modification time field contains a timestamp.');
$this->assertIsNumeric($test_mtime);
$this->assertGreaterThan(0, $test_mtime);
}
/**
......
......@@ -316,7 +316,8 @@ public function providerSortByTitleProperty() {
* Actual comparison function return value.
*/
protected function assertBothNegativePositiveOrZero($expected, $result) {
$this->assertTrue(is_numeric($expected) && is_numeric($result), 'Parameters are numeric.');
$this->assertIsNumeric($expected);
$this->assertIsNumeric($result);
$this->assertTrue(($expected < 0 && $result < 0) || ($expected > 0 && $result > 0) || ($expected === 0 && $result === 0), 'Numbers are either both negative, both positive or both zero.');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment