Skip to content

Instantly share code, notes, and snippets.

@SelrahcD
Last active November 9, 2016 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SelrahcD/281cf7d3ba226bbd1471a9b068690f57 to your computer and use it in GitHub Desktop.
Save SelrahcD/281cf7d3ba226bbd1471a9b068690f57 to your computer and use it in GitHub Desktop.
TypeTest.php
<?php
class Type {
const TYPE_A = 1;
const TYPE_B = 2;
const TYPE_C = 3;
private $type;
private function __construct($type)
{
$this->type = $type;
}
static public function A()
{
return new self(self::TYPE_A);
}
static public function B()
{
return new self(self::TYPE_B);
}
static public function C()
{
return new self(self::TYPE_B);
}
}
class TypeTest extends \PHPUnit_Framework_TestCase
{
/**
* @test
*/
public function a_type_is_different_than_another_one()
{
$allTypes = [
Type::A(),
Type::B(),
Type::C(),
];
$typeCount = count($allTypes);
for($i = 0; $i < $typeCount; $i++) {
for($j = 0; $j < $typeCount; $j++) {
if($j !== $i) {
$this->assertNotEquals($allTypes[$i], $allTypes[$j], 'Several discussion types are equals.');
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment