Skip to content

Commit 74eb317

Browse files
committed
Cleaned up Verify tests
1 parent b25870e commit 74eb317

File tree

3 files changed

+69
-60
lines changed

3 files changed

+69
-60
lines changed

test/Verify/ClientTest.php

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -175,54 +175,6 @@ public function testCanStartVerification(): void
175175
$this->assertSame($success, @$verification->getResponse());
176176
}
177177

178-
public function invalidDataDataProvider(): array
179-
{
180-
return [
181-
[
182-
'Country must be in two character format',
183-
'Test Invalid Country',
184-
'setCountry',
185-
'GER'
186-
],
187-
[
188-
sprintf('Pin length must be either %d or %d digits', Request::PIN_LENGTH_4, Request::PIN_LENGTH_6),
189-
'Test Invalid Code Length',
190-
'setCodeLength',
191-
123
192-
],
193-
[
194-
'Pin expiration must be between 60 and 3600 seconds',
195-
'Test Invalid Pin Expiry',
196-
'setPinExpiry',
197-
30
198-
],
199-
[
200-
'Next Event time must be between 60 and 900 seconds',
201-
'Test Invalid Next Event Wait',
202-
'setNextEventWait',
203-
30
204-
],
205-
[
206-
'Workflow ID must be from 1 to 7',
207-
'Test Invalid Invalid Workflow Id',
208-
'setWorkflowId',
209-
123
210-
],
211-
];
212-
}
213-
214-
/**
215-
* @dataProvider invalidDataDataProvider
216-
*/
217-
public function testInvalidData(string $expectedMessage, string $brand, string $method, $data): void
218-
{
219-
$this->expectException(InvalidArgumentException::class);
220-
$this->expectExceptionMessage($expectedMessage);
221-
222-
(new Request('14845551212', $brand))
223-
->$method($data);
224-
}
225-
226178
/**
227179
* @throws ClientExceptionInterface
228180
* @throws Client\Exception\Exception

test/Verify/RequestTest.php

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
3+
namespace VonageTest\Verify;
4+
5+
use InvalidArgumentException;
6+
use PHPUnit\Framework\TestCase;
7+
use Vonage\Verify\Request;
8+
9+
class RequestTest extends TestCase
10+
{
11+
public function invalidDataDataProvider(): array
12+
{
13+
return [
14+
[
15+
'Country must be in two character format',
16+
'Test Invalid Country',
17+
'setCountry',
18+
'GER'
19+
],
20+
[
21+
sprintf('Pin length must be either %d or %d digits', Request::PIN_LENGTH_4, Request::PIN_LENGTH_6),
22+
'Test Invalid Code Length',
23+
'setCodeLength',
24+
123
25+
],
26+
[
27+
'Pin expiration must be between 60 and 3600 seconds',
28+
'Test Invalid Pin Expiry',
29+
'setPinExpiry',
30+
30
31+
],
32+
[
33+
'Next Event time must be between 60 and 900 seconds',
34+
'Test Invalid Next Event Wait',
35+
'setNextEventWait',
36+
30
37+
],
38+
[
39+
'Workflow ID must be from 1 to 7',
40+
'Test Invalid Invalid Workflow Id',
41+
'setWorkflowId',
42+
123
43+
],
44+
];
45+
}
46+
47+
/**
48+
* @dataProvider invalidDataDataProvider
49+
*/
50+
public function testInvalidData(string $expectedMessage, string $brand, string $method, $data): void
51+
{
52+
$this->expectException(InvalidArgumentException::class);
53+
$this->expectExceptionMessage($expectedMessage);
54+
55+
(new Request('14845551212', $brand))
56+
->$method($data);
57+
}
58+
59+
public function testCanSetCodeLength()
60+
{
61+
$request = new Request(14845551212, 'Vonage');
62+
63+
$request->setCodeLength(4);
64+
$this->assertSame(4, $request->getCodeLength());
65+
66+
$request->setCodeLength(6);
67+
$this->assertSame(6, $request->getCodeLength());
68+
}
69+
}

test/Verify/VerificationTest.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,6 @@ public function testResponseDataAsArray($type): void
226226
foreach ($json as $key => $value) {
227227
$this->assertEquals($value, @$this->existing[$key], "Could not access `$key` as a property.");
228228
}
229-
230-
self::markTestIncomplete('Remove deprecated tests');
231229
}
232230

233231
/**
@@ -273,8 +271,6 @@ public function testMethodsProxyClient($method, $proxy, $code = null, $ip = null
273271
} else {
274272
@$this->existing->$method();
275273
}
276-
277-
self::markTestIncomplete('Remove deprecated tests');
278274
}
279275

280276
/**
@@ -294,8 +290,6 @@ public function testCheckReturnsBoolForInvalidCode(): void
294290

295291
@$this->assertFalse($this->existing->check('4321'));
296292
@$this->assertTrue($this->existing->check('1234'));
297-
298-
self::markTestIncomplete('Remove deprecated tests');
299293
}
300294

301295
/**
@@ -315,8 +309,6 @@ public function testCheckReturnsBoolForTooManyAttempts(): void
315309

316310
@$this->assertFalse($this->existing->check('4321'));
317311
@$this->assertTrue($this->existing->check('1234'));
318-
319-
self::markTestIncomplete('Remove deprecated tests');
320312
}
321313

322314
/**
@@ -336,8 +328,6 @@ public function testExceptionForCheckFail(): void
336328

337329
$this->expectException(RequestException::class);
338330
@$this->existing->check('4321');
339-
340-
self::markTestIncomplete('Remove deprecated tests');
341331
}
342332

343333
/**
@@ -360,8 +350,6 @@ public function testSerialize($response): void
360350
$this->assertEquals(@$this->existing->getAccountId(), @$unserialized->getAccountId());
361351
$this->assertEquals(@$this->existing->getStatus(), @$unserialized->getStatus());
362352
$this->assertEquals(@$this->existing->getResponseData(), @$unserialized->getResponseData());
363-
364-
self::markTestIncomplete('Remove deprecated tests');
365353
}
366354

367355
/**

0 commit comments

Comments
 (0)