expectException(\Exception::class); $this->expectExceptionMessage("Invalid value '' for 'active' specified. Allowed values: '0' or '1'"); $this->buildActive('')->check(); } public function testCheckShouldFailWhenActiveIsNotValid() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invalid value 'anyValUe' for 'active' specified. Allowed values: '0' or '1'"); $this->buildActive('anyValUe')->check(); } public function testCheckShouldFailWhenActiveIsNumericButNot0or1() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invalid value '2'"); $this->buildActive('2')->check(); } public function testCheckShouldNotFailWhenActiveIsValid() { self::expectNotToPerformAssertions(); $this->buildActive(true)->check(); $this->buildActive(false)->check(); $this->buildActive(0)->check(); $this->buildActive(1)->check(); $this->buildActive('0')->check(); $this->buildActive('1')->check(); } private function buildActive($active) { return new Active($active); } }