File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed
src/DocScan/Session/Create
tests/DocScan/Session/Create Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Yoti \DocScan \Session \Create ;
4
4
5
- class IbvOptions
5
+ use JsonSerializable ;
6
+ use Yoti \Util \Json ;
7
+
8
+ class IbvOptions implements JsonSerializable
6
9
{
7
10
/**
8
11
* @var string
@@ -39,4 +42,16 @@ public function getGuidanceUrl(): ?string
39
42
{
40
43
return $ this ->guidanceUrl ;
41
44
}
45
+
46
+
47
+ /**
48
+ * @return \stdClass
49
+ */
50
+ public function jsonSerialize (): \stdClass
51
+ {
52
+ return (object )Json::withoutNullValues ([
53
+ 'support ' => $ this ->getSupport (),
54
+ 'guidance_url ' => $ this ->getGuidanceUrl (),
55
+ ]);
56
+ }
42
57
}
Original file line number Diff line number Diff line change @@ -78,4 +78,23 @@ public function builderShouldSetCorrectGuidanceUrlValue()
78
78
79
79
$ this ->assertEquals (self ::SOME_GUIDANCE_URL , $ result ->getGuidanceUrl ());
80
80
}
81
+
82
+ /**
83
+ * @test
84
+ * @covers \Yoti\DocScan\Session\Create\IbvOptions::jsonSerialize
85
+ */
86
+ public function shouldSerializeWithCorrectProperties (): void
87
+ {
88
+ $ result = (new IbvOptionsBuilder ())
89
+ ->withIbvNotAllowed ()
90
+ ->withGuidanceUrl (self ::SOME_GUIDANCE_URL )
91
+ ->build ();
92
+
93
+ $ expected = [
94
+ 'support ' => 'NOT_ALLOWED ' ,
95
+ 'guidance_url ' => self ::SOME_GUIDANCE_URL ,
96
+ ];
97
+
98
+ $ this ->assertJsonStringEqualsJsonString (json_encode ($ expected ), json_encode ($ result ));
99
+ }
81
100
}
You can’t perform that action at this time.
0 commit comments