Skip to content

Commit 325ddbf

Browse files
committed
Added person name parser test.
1 parent 3506a3c commit 325ddbf

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

tests/functional/org/nameapi/client/services/BaseServiceTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@ protected function makeContext() {
3030
->build();
3131
}
3232

33+
/**
34+
* @return ServiceFactory
35+
*/
36+
protected function makeServiceFactory() {
37+
return new ServiceFactory($this->makeContext());
38+
}
39+
3340
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace org\nameapi\client\services\parser\personnameparser;
4+
5+
require_once(__DIR__.'/../../BaseServiceTest.php');
6+
7+
use org\nameapi\client\services\BaseServiceTest;
8+
use org\nameapi\ontology\input\entities\person\NaturalInputPerson;
9+
use org\nameapi\ontology\input\entities\person\name\InputPersonName;
10+
11+
class PersonNameParserServiceTest extends BaseServiceTest {
12+
13+
public function testPing() {
14+
$personNameParser = $this->makeServiceFactory()->parserServices()->personNameParser();
15+
$inputPerson = NaturalInputPerson::builder()
16+
->name(InputPersonName::westernBuilder()
17+
->fullname( "John Doe" )
18+
->build())
19+
->build();
20+
$parseResult = $personNameParser->parse($inputPerson);
21+
$this->assertEquals($parseResult->getParsingStatus()->toString(), 'SUCCESS');
22+
}
23+
24+
}

tests/functional/org/nameapi/client/services/system/pinger/PingerServiceTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
require_once(__DIR__.'/../../BaseServiceTest.php');
66

77
use org\nameapi\client\services\BaseServiceTest;
8-
use org\nameapi\client\services\ServiceFactory;
98

109
class PingerServiceTest extends BaseServiceTest {
1110

1211
public function testPing() {
13-
$serviceFactory = new ServiceFactory($this->makeContext());
14-
$pinger = $serviceFactory->systemServices()->pingerService();
12+
$pinger = $this->makeServiceFactory()->systemServices()->pingerService();
1513
$pong = $pinger->ping();
1614
$this->assertEquals($pong, 'pong');
1715
}

0 commit comments

Comments
 (0)