File tree 2 files changed +9
-16
lines changed
2 files changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ public static function isValid($value)
198
198
* @psalm-pure
199
199
* @psalm-assert T $value
200
200
*/
201
- public static function assertValidValue ($ value ): void
201
+ private static function assertValidValue ($ value ): void
202
202
{
203
203
if (!static ::isValid ($ value )) {
204
204
throw new \UnexpectedValueException ("Value ' $ value' is not part of the enum " . static ::class);
Original file line number Diff line number Diff line change @@ -60,6 +60,14 @@ public function testFailToCreateEnumWithInvalidValueThroughNamedConstructor($val
60
60
EnumFixture::from ($ value );
61
61
}
62
62
63
+ public function testFailToCreateEnumWithEnumItselfThroughNamedConstructor (): void
64
+ {
65
+ $ this ->expectException (\UnexpectedValueException::class);
66
+ $ this ->expectExceptionMessage ("Value 'foo' is not part of the enum " . EnumFixture::class);
67
+
68
+ EnumFixture::from (EnumFixture::FOO ());
69
+ }
70
+
63
71
/**
64
72
* Contains values not existing in EnumFixture
65
73
* @return array
@@ -344,19 +352,4 @@ public function testEnumValuesInheritance()
344
352
$ inheritedEnumFixture = InheritedEnumFixture::VALUE ();
345
353
new EnumFixture ($ inheritedEnumFixture );
346
354
}
347
-
348
- /**
349
- * @dataProvider isValidProvider
350
- */
351
- public function testAssertValidValue ($ value , $ isValid ): void
352
- {
353
- if (!$ isValid ) {
354
- $ this ->expectException (\UnexpectedValueException::class);
355
- $ this ->expectExceptionMessage ("Value ' $ value' is not part of the enum " . EnumFixture::class);
356
- }
357
-
358
- EnumFixture::assertValidValue ($ value );
359
-
360
- self ::assertTrue (EnumFixture::isValid ($ value ));
361
- }
362
355
}
You can’t perform that action at this time.
0 commit comments