File tree 2 files changed +22
-9
lines changed 2 files changed +22
-9
lines changed Original file line number Diff line number Diff line change 7
7
class FallbackResolverException extends Exception
8
8
{
9
9
protected const int UNABLE_TO_FIND_RESOLVER_CLASS = 0 ;
10
- protected const int UNABLE_TO_RESOLVE_DEFAULT_VALUE = 1 ;
11
10
12
11
public static function unableToFindResolverClass (string $ resolverClass ): self
13
12
{
@@ -16,12 +15,4 @@ public static function unableToFindResolverClass(string $resolverClass): self
16
15
self ::UNABLE_TO_FIND_RESOLVER_CLASS
17
16
);
18
17
}
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
- }
27
18
}
Original file line number Diff line number Diff line change 8
8
use Nuxtifyts \PhpDto \Contracts \EmptyData as EmptyDataContract ;
9
9
use Nuxtifyts \PhpDto \Data ;
10
10
use Nuxtifyts \PhpDto \Enums \Property \Type ;
11
+ use Nuxtifyts \PhpDto \Exceptions \DataCreationException ;
11
12
use Nuxtifyts \PhpDto \Tests \Dummies \AddressData ;
12
13
use Nuxtifyts \PhpDto \Tests \Dummies \CountryData ;
13
14
use Nuxtifyts \PhpDto \Tests \Dummies \Enums \YesNoBackedEnum ;
27
28
#[CoversClass(Data::class)]
28
29
#[CoversClass(PropertyContext::class)]
29
30
#[CoversClass(ClassContext::class)]
31
+ #[CoversClass(DataCreationException::class)]
30
32
#[UsesClass(ArrayOfScalarTypes::class)]
31
33
#[UsesClass(PointGroupData::class)]
32
34
#[UsesClass(PointData::class)]
@@ -167,4 +169,24 @@ public function __construct(
167
169
],
168
170
];
169
171
}
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
+ }
170
192
}
You can’t perform that action at this time.
0 commit comments