expectException(\Exception::class); $this->expectExceptionMessage("Invalid value '' for 'scope' specified. Available scopes are: visit, action, conversion"); $this->buildScope('')->check(); } public function test_check_shouldFailWhenScopeIsNotValid() { $this->expectException(\Exception::class); $this->expectExceptionMessage("Invalid value 'anyScoPe' for 'scope' specified. Available scopes are: visit, action, conversion"); $this->buildScope('anyScoPe')->check(); } public function test_check_shouldNotFailWhenScopeIsValid() { $this->buildScope('action')->check(); $this->buildScope('visit')->check(); $this->buildScope('conversion')->check(); self::assertTrue(true); } private function buildScope($scope) { return new Scope($scope); } }