File tree Expand file tree Collapse file tree 2 files changed +22
-9
lines changed Expand file tree Collapse file tree 2 files changed +22
-9
lines changed Original file line number Diff line number Diff line change 77class FallbackResolverException extends Exception
88{
99 protected const int UNABLE_TO_FIND_RESOLVER_CLASS = 0 ;
10- protected const int UNABLE_TO_RESOLVE_DEFAULT_VALUE = 1 ;
1110
1211 public static function unableToFindResolverClass (string $ resolverClass ): self
1312 {
@@ -16,12 +15,4 @@ public static function unableToFindResolverClass(string $resolverClass): self
1615 self ::UNABLE_TO_FIND_RESOLVER_CLASS
1716 );
1817 }
19-
20- public static function unableToResolveDefaultValue (): self
21- {
22- return new self (
23- 'Unable to resolve default value ' ,
24- self ::UNABLE_TO_RESOLVE_DEFAULT_VALUE
25- );
26- }
2718}
Original file line number Diff line number Diff line change 88use Nuxtifyts \PhpDto \Contracts \EmptyData as EmptyDataContract ;
99use Nuxtifyts \PhpDto \Data ;
1010use Nuxtifyts \PhpDto \Enums \Property \Type ;
11+ use Nuxtifyts \PhpDto \Exceptions \DataCreationException ;
1112use Nuxtifyts \PhpDto \Tests \Dummies \AddressData ;
1213use Nuxtifyts \PhpDto \Tests \Dummies \CountryData ;
1314use Nuxtifyts \PhpDto \Tests \Dummies \Enums \YesNoBackedEnum ;
2728#[CoversClass(Data::class)]
2829#[CoversClass(PropertyContext::class)]
2930#[CoversClass(ClassContext::class)]
31+ #[CoversClass(DataCreationException::class)]
3032#[UsesClass(ArrayOfScalarTypes::class)]
3133#[UsesClass(PointGroupData::class)]
3234#[UsesClass(PointData::class)]
@@ -167,4 +169,24 @@ public function __construct(
167169 ],
168170 ];
169171 }
172+
173+ /**
174+ * @throws Throwable
175+ */
176+ #[Test]
177+ public function will_throw_exception_when_parameter_is_not_linked_to_a_property (): void
178+ {
179+ $ object = new readonly class ('' ) extends Data {
180+ public string $ otherPropertyName ;
181+
182+ public function __construct (
183+ string $ parameterName
184+ ) {
185+ $ this ->otherPropertyName = $ parameterName ;
186+ }
187+ };
188+
189+ self ::expectException (DataCreationException::class);
190+ $ object ::empty ();
191+ }
170192}
You can’t perform that action at this time.
0 commit comments