File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ public function __construct(array $values)
72
72
Assert::keyExists ($ values , 'path ' );
73
73
74
74
if (null !== $ values ['path ' ]) {
75
- $ path = TrimmedNonEmptyString::fromString ($ values ['path ' ])->toString ();
75
+ $ path = TrimmedNonEmptyString::fromString ($ values ['path ' ], ' The value of key "path" is invalid. ' )->toString ();
76
76
}
77
77
78
78
$ this ->path = $ path ?? null ;
Original file line number Diff line number Diff line change 14
14
15
15
namespace Storyblok \Api \Tests \Unit \Domain \Value ;
16
16
17
+ use Ergebnis \DataProvider \StringProvider ;
18
+ use PHPUnit \Framework \Attributes \DataProviderExternal ;
17
19
use PHPUnit \Framework \Attributes \Test ;
18
20
use PHPUnit \Framework \TestCase ;
19
21
use Storyblok \Api \Domain \Value \Link ;
@@ -153,6 +155,19 @@ public function pathKeyMustExist(): void
153
155
new Link ($ values );
154
156
}
155
157
158
+ #[DataProviderExternal(StringProvider::class, 'blank ' )]
159
+ #[DataProviderExternal(StringProvider::class, 'empty ' )]
160
+ #[Test]
161
+ public function pathMustBeValidString (string $ value ): void
162
+ {
163
+ $ values = self ::faker ()->linkResponse (['path ' => $ value ]);
164
+
165
+ self ::expectExceptionMessage ('The value of key "path" is invalid. ' );
166
+ self ::expectException (\InvalidArgumentException::class);
167
+
168
+ new Link ($ values );
169
+ }
170
+
156
171
#[Test]
157
172
public function isFolder (): void
158
173
{
You can’t perform that action at this time.
0 commit comments