Skip to content

Commit 70c2b01

Browse files
committed
added background view test
1 parent e863303 commit 70c2b01

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/ViewTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,35 @@ public function testView3()
8787
$this->assertEquals('', $background);
8888

8989
}
90+
91+
92+
public function testView4()
93+
{
94+
// Create a stub for the SomeClass class.
95+
$configStub = $this->createMock(ReCaptchaConfigV3::class);
96+
97+
// Configure the stub.
98+
$configStub->method('isServiceEnabled')
99+
->willReturn(true);
100+
101+
$configStub->method('getSiteKey')
102+
->willReturn('test1');
103+
104+
$configStub->method('isInline')
105+
->willReturn(false);
106+
107+
$configStub->method('getLanguage')
108+
->willReturn('en');
109+
110+
$configStub->method('getBackgroundBadgeDisplay')
111+
->willReturn(false);
112+
113+
$clientStub = $this->createMock(GuzzleRequestClient::class);
114+
115+
$_service = new GoogleReCaptchaV3Service($configStub, $clientStub);
116+
$service = new GoogleReCaptchaV3($_service);
117+
$data = $service->prepareBackgroundData();
118+
$this->assertEquals(false, $data['display']);
119+
$this->assertEquals('test1', $data['publicKey']);
120+
}
90121
}

0 commit comments

Comments
 (0)