Last active
November 9, 2016 09:32
-
-
Save SelrahcD/281cf7d3ba226bbd1471a9b068690f57 to your computer and use it in GitHub Desktop.
TypeTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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