diff --git a/src/Assert.php b/src/Assert.php index b8fa12ac..a0cd0154 100644 --- a/src/Assert.php +++ b/src/Assert.php @@ -37,14 +37,14 @@ class Assert public function isNull($actual) { - if ($actual !== null and $actual !== false) - $this->fail('Assertion failed. Expected: NULL, got: "' . $actual . '"'); + if ($actual !== null) + $this->fail('Assertion failed. Expected: NULL, got: "' . $this->dumpVar(actual) . '"'); } public function isNotNull($actual) { - if ($actual === null or $actual === false) - $this->fail('Assertion failed. Expected: not NULL, got: "' . $actual . '"'); + if ($actual === null) + $this->fail('Assertion failed. Expected: not NULL, got: "' . $this->dumpVar(actual) . '"'); } public function isTrue($actual) diff --git a/tests/Tests/JobTests/ActivateUserEmailJobTest.php b/tests/Tests/JobTests/ActivateUserEmailJobTest.php index 126f512b..ed5cbf49 100644 --- a/tests/Tests/JobTests/ActivateUserEmailJobTest.php +++ b/tests/Tests/JobTests/ActivateUserEmailJobTest.php @@ -43,7 +43,7 @@ class ActivateUserEmailJobTest extends AbstractTest UserModel::save($user); $this->assert->areEqual('godzilla@whitestar.gov', $user->getUnconfirmedEmail()); - $this->assert->areEqual(null, $user->getConfirmedEmail()); + $this->assert->isNull($user->getConfirmedEmail()); $this->assert->doesNotThrow(function() use ($user) { @@ -68,7 +68,7 @@ class ActivateUserEmailJobTest extends AbstractTest //reload local entity after changes done by the job $user = UserModel::getById($user->getId()); - $this->assert->areEqual(null, $user->getUnconfirmedEmail()); + $this->assert->isNull($user->getUnconfirmedEmail()); $this->assert->areEqual('godzilla@whitestar.gov', $user->getConfirmedEmail()); } @@ -82,7 +82,7 @@ class ActivateUserEmailJobTest extends AbstractTest UserModel::save($user); $this->assert->areEqual('godzilla@whitestar.gov', $user->getUnconfirmedEmail()); - $this->assert->areEqual(null, $user->getConfirmedEmail()); + $this->assert->isNull($user->getConfirmedEmail()); Api::run( new ActivateUserEmailJob(), diff --git a/tests/Tests/JobTests/AddPostJobTest.php b/tests/Tests/JobTests/AddPostJobTest.php index 9da3b71d..5029111a 100644 --- a/tests/Tests/JobTests/AddPostJobTest.php +++ b/tests/Tests/JobTests/AddPostJobTest.php @@ -58,7 +58,7 @@ class AddPostJobTest extends AbstractTest file_get_contents($post->getFullPath()), file_get_contents($this->testSupport->getPath('image.jpg'))); $this->assert->areNotEqual(Auth::getCurrentUser()->getId(), $post->getUploaderId()); - $this->assert->areEqual(null, $post->getUploaderId()); + $this->assert->isNull($post->getUploaderId()); } public function testPartialPrivilegeFail() diff --git a/tests/Tests/JobTests/AddUserJobTest.php b/tests/Tests/JobTests/AddUserJobTest.php index 8bbbac42..2ef0e7bc 100644 --- a/tests/Tests/JobTests/AddUserJobTest.php +++ b/tests/Tests/JobTests/AddUserJobTest.php @@ -162,7 +162,7 @@ class AddUserJobTest extends AbstractTest }); //first user = admin = has confirmed e-mail automatically - $this->assert->areEqual(null, $user1->getUnconfirmedEmail()); + $this->assert->isNull($user1->getUnconfirmedEmail()); $this->assert->areEqual('godzilla@whitestar.gov', $user1->getConfirmedEmail()); $user2 = $this->assert->doesNotThrow(function() @@ -178,7 +178,7 @@ class AddUserJobTest extends AbstractTest //any other user = non-admin = has to confirmed e-mail manually $this->assert->areEqual('godzilla2@whitestar.gov', $user2->getUnconfirmedEmail()); - $this->assert->areEqual(null, $user2->getConfirmedEmail()); + $this->assert->isNull($user2->getConfirmedEmail()); $this->assert->areEqual(1, Mailer::getMailCounter()); } @@ -204,7 +204,7 @@ class AddUserJobTest extends AbstractTest }); $this->assert->areEqual('godzilla@whitestar.gov', $user1->getUnconfirmedEmail()); - $this->assert->areEqual(null, $user1->getConfirmedEmail()); + $this->assert->isNull($user1->getConfirmedEmail()); $user2 = $this->assert->doesNotThrow(function() { @@ -218,7 +218,7 @@ class AddUserJobTest extends AbstractTest }); $this->assert->areEqual('godzilla2@whitestar.gov', $user2->getUnconfirmedEmail()); - $this->assert->areEqual(null, $user2->getConfirmedEmail()); + $this->assert->isNull($user2->getConfirmedEmail()); $this->assert->areEqual(2, Mailer::getMailCounter()); } @@ -243,7 +243,7 @@ class AddUserJobTest extends AbstractTest ]); }); - $this->assert->areEqual(null, $user1->getUnconfirmedEmail()); + $this->assert->isNull($user1->getUnconfirmedEmail()); $this->assert->areEqual('godzilla@whitestar.gov', $user1->getConfirmedEmail()); $user2 = $this->assert->doesNotThrow(function() @@ -257,7 +257,7 @@ class AddUserJobTest extends AbstractTest ]); }); - $this->assert->areEqual(null, $user2->getUnconfirmedEmail()); + $this->assert->isNull($user2->getUnconfirmedEmail()); $this->assert->areEqual('godzilla2@whitestar.gov', $user2->getConfirmedEmail()); $this->assert->areEqual(0, Mailer::getMailCounter()); diff --git a/tests/Tests/JobTests/DeletePostJobTest.php b/tests/Tests/JobTests/DeletePostJobTest.php index 3e3f6cdf..a398b78e 100644 --- a/tests/Tests/JobTests/DeletePostJobTest.php +++ b/tests/Tests/JobTests/DeletePostJobTest.php @@ -16,7 +16,7 @@ class DeletePostJobTest extends AbstractTest ]); }); - $this->assert->areEqual(null, PostModel::tryGetByName($post->getName())); + $this->assert->isNull(PostModel::tryGetByName($post->getName())); $this->assert->areEqual(0, PostModel::getCount()); } diff --git a/tests/Tests/JobTests/DeleteUserJobTest.php b/tests/Tests/JobTests/DeleteUserJobTest.php index 0a77011d..6611df7a 100644 --- a/tests/Tests/JobTests/DeleteUserJobTest.php +++ b/tests/Tests/JobTests/DeleteUserJobTest.php @@ -16,7 +16,7 @@ class DeleteUserJobTest extends AbstractTest ]); }); - $this->assert->areEqual(null, UserModel::tryGetByName($user->getName())); + $this->assert->isNull(UserModel::tryGetByName($user->getName())); $this->assert->areEqual(0, UserModel::getCount()); } diff --git a/tests/Tests/JobTests/EditUserEmailJobTest.php b/tests/Tests/JobTests/EditUserEmailJobTest.php index d43869fa..41049dba 100644 --- a/tests/Tests/JobTests/EditUserEmailJobTest.php +++ b/tests/Tests/JobTests/EditUserEmailJobTest.php @@ -22,7 +22,7 @@ class EditUserEmailJobTest extends AbstractTest ]); }); - $this->assert->areEqual(null, $user->getUnconfirmedEmail()); + $this->assert->isNull($user->getUnconfirmedEmail()); $this->assert->areEqual('xena@other-side.gr', $user->getConfirmedEmail()); $this->assert->areEqual(0, Mailer::getMailCounter()); @@ -50,7 +50,7 @@ class EditUserEmailJobTest extends AbstractTest }); $this->assert->areEqual('xena@other-side.gr', $user->getUnconfirmedEmail()); - $this->assert->areEqual(null, $user->getConfirmedEmail()); + $this->assert->isNull($user->getConfirmedEmail()); $this->assert->areEqual(1, Mailer::getMailCounter()); } @@ -100,8 +100,8 @@ class EditUserEmailJobTest extends AbstractTest ]); }, 'User with this e-mail is already registered'); - $this->assert->areEqual(null, $user->getUnconfirmedEmail()); - $this->assert->areEqual(null, $user->getConfirmedEmail()); + $this->assert->isNull($user->getUnconfirmedEmail()); + $this->assert->isNull($user->getConfirmedEmail()); $this->assert->areEqual(0, Mailer::getMailCounter()); } diff --git a/tests/Tests/JobTests/FeaturePostJobTest.php b/tests/Tests/JobTests/FeaturePostJobTest.php index 894d80af..359a5332 100644 --- a/tests/Tests/JobTests/FeaturePostJobTest.php +++ b/tests/Tests/JobTests/FeaturePostJobTest.php @@ -41,6 +41,6 @@ class FeaturePostJobTest extends AbstractTest }); $this->assert->areEqual($posts[1]->getId(), PropertyModel::get(PropertyModel::FeaturedPostId)); - $this->assert->areEqual(null, PropertyModel::get(PropertyModel::FeaturedPostUserName)); + $this->assert->isNull(PropertyModel::get(PropertyModel::FeaturedPostUserName)); } } diff --git a/tests/Tests/MiscTests/TextHelperTest.php b/tests/Tests/MiscTests/TextHelperTest.php index 6ae60612..492f0f34 100644 --- a/tests/Tests/MiscTests/TextHelperTest.php +++ b/tests/Tests/MiscTests/TextHelperTest.php @@ -25,12 +25,12 @@ class TextHelperTest extends AbstractTest $this->assert->areEqual(-2, TextHelper::toIntegerOrNull('-2')); $this->assert->areEqual(0, TextHelper::toIntegerOrNull(0)); $this->assert->areEqual(0, TextHelper::toIntegerOrNull('0')); - $this->assert->areEqual(null, TextHelper::toIntegerOrNull('rubbish')); - $this->assert->areEqual(null, TextHelper::toIntegerOrNull('1e1')); - $this->assert->areEqual(null, TextHelper::toIntegerOrNull('1.7')); - $this->assert->areEqual(null, TextHelper::toIntegerOrNull(true)); - $this->assert->areEqual(null, TextHelper::toIntegerOrNull(false)); - $this->assert->areEqual(null, TextHelper::toIntegerOrNull(null)); + $this->assert->isNull(TextHelper::toIntegerOrNull('rubbish')); + $this->assert->isNull(TextHelper::toIntegerOrNull('1e1')); + $this->assert->isNull(TextHelper::toIntegerOrNull('1.7')); + $this->assert->isNull(TextHelper::toIntegerOrNull(true)); + $this->assert->isNull(TextHelper::toIntegerOrNull(false)); + $this->assert->isNull(TextHelper::toIntegerOrNull(null)); } public function testToBooleanOrNull() @@ -51,9 +51,9 @@ class TextHelperTest extends AbstractTest $this->assert->isFalse(TextHelper::toBooleanOrNull('FaLsE')); $this->assert->isFalse(TextHelper::toBooleanOrNull('false')); $this->assert->isFalse(TextHelper::toBooleanOrNull(false)); - $this->assert->areEqual(null, TextHelper::toBooleanOrNull(2)); - $this->assert->areEqual(null, TextHelper::toBooleanOrNull('2')); - $this->assert->areEqual(null, TextHelper::toBooleanOrNull('rubbish')); - $this->assert->areEqual(null, TextHelper::toBooleanOrNull(null)); + $this->assert->isNull(TextHelper::toBooleanOrNull(2)); + $this->assert->isNull(TextHelper::toBooleanOrNull('2')); + $this->assert->isNull(TextHelper::toBooleanOrNull('rubbish')); + $this->assert->isNull(TextHelper::toBooleanOrNull(null)); } } diff --git a/tests/Tests/ModelTests/PostModelTest.php b/tests/Tests/ModelTests/PostModelTest.php index 60d97d91..08cef62b 100644 --- a/tests/Tests/ModelTests/PostModelTest.php +++ b/tests/Tests/ModelTests/PostModelTest.php @@ -8,7 +8,7 @@ class PostModelTest extends AbstractTest return PostModel::getFeaturedPost(); }); - $this->assert->areEqual(null, $post); + $this->assert->isNull($post); } public function testFeaturingNoPost() @@ -20,7 +20,7 @@ class PostModelTest extends AbstractTest return PostModel::getFeaturedPost(); }); - $this->assert->areEqual(null, $post); + $this->assert->isNull($post); } public function testFeaturingRandomPost() @@ -46,7 +46,7 @@ class PostModelTest extends AbstractTest PostModel::featureRandomPost(); - $this->assert->areEqual(null, PropertyModel::get(PropertyModel::FeaturedPostId)); + $this->assert->isNull(PropertyModel::get(PropertyModel::FeaturedPostId)); } public function testAutoFeaturingFirstTime()