public function testEquals() { $review1 = new StatusEnum(StatusEnum::REVIEW); $review2 = new StatusEnum(StatusEnum::REVIEW); $draft = new StatusEnum(StatusEnum::DRAFT); $this->assertTrue($review1->equals($review2)); $this->assertFalse($review1->equals($draft)); $admin = new RoleEnum(RoleEnum::ADMIN); try { $review1->equals($admin); $this->fail(); } catch (InvalidEnumTypeException $e) { $this->assertSame($admin, $e->getEnum()); $this->assertSame(get_class($review1), $e->getExpectedClass()); } }
/** * @test */ public function use_constant_name_to_construct() { $status1 = new StatusEnum(); $status2 = new StatusEnum(StatusEnum::ACTIVE); $status3 = StatusEnum::ACTIVE(); $this->assertEquals($status1, $status2); $this->assertEquals($status1, $status3); }