PHPUnit_Assert::assert*Not*Equals()?

From: Date: Sat, 19 Oct 2002 23:21:27 +0000
Subject: PHPUnit_Assert::assert*Not*Equals()?
Groups: php.dev 
Request: Send a blank email to php-dev+get-89752@lists.php.net to get a copy of this message
This may be a really dumb question, but why isn't there a PHPUnit_Assert::assertNotEquals() method? Equality is a complex enough operation, I'd hate to have to do this in my PHPUnit tests: function equals($a_Actual, $a_Expected) { $equivalent = false; // All the inverse logic of PHPUnit_Assert::assertEquals() ... return $equivalent; } ... function testFoo() { $this->assertFalse(equals($actual, $expected), ...); } or worse: // What if this passes? I'll never know unless I'm looking for it! $this->assertEquals($actual, $expected, 'This test should fail.'); Attached is a patch to add assertNotEquals() to PHPUnit_Assert. Please consider including it (or something like it) in future releases. (Pretty please?) Here's the legalese for the patch which basically says you can do with it whatever you want, but you can't sue me if it doesn't work or breaks something (stolen from the MIT license): Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- Please do not sell or give away my information.

Attachment: [text/x-patch] phpunit.patch
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
« previous php.dev (#89752) next »