public function test_parseTwoPeople() { //setup code: $context = Context::builder()->priority(Priority::REALTIME())->build(); $myApiKey = 'test'; //grab one from nameapi.org $serviceFactory = new ServiceFactory($myApiKey, $context, Host::http('rc50-api.nameapi.org'), '5.0'); $personNameParser = $serviceFactory->parserServices()->personNameParser(); //the call: $inputPerson = NaturalInputPerson::builder()->name(InputPersonName::westernBuilder()->fullname("Peter und Daniela Meyer")->build())->build(); $parseResult = $personNameParser->parse($inputPerson); //the assertions: $bestMatch = $parseResult->getBestMatch(); $this->assertEquals('MULTIPLE', (string) $bestMatch->getParsedPerson()->getPersonType()); $people = $bestMatch->getParsedPerson()->getPeople(); $this->assertEquals(2, sizeof($people)); $firstPerson = $people[0]; $this->assertEquals('Peter', $firstPerson->getAddressingGivenName()); $this->assertEquals('Meyer', $firstPerson->getAddressingSurname()); $this->assertEquals('MALE', (string) $firstPerson->getGender()->getGender()); $secondPerson = $people[1]; $this->assertEquals('Daniela', $secondPerson->getAddressingGivenName()); $this->assertEquals('Meyer', $secondPerson->getAddressingSurname()); $this->assertEquals('FEMALE', (string) $secondPerson->getGender()->getGender()); }
public function testDea() { //setup code: $context = Context::builder()->priority(Priority::REALTIME())->build(); $myApiKey = 'test'; //grab one from nameapi.org $serviceFactory = new ServiceFactory($myApiKey, $context, Host::http('rc50-api.nameapi.org'), '5.0'); //the call: $deaDetector = $serviceFactory->emailServices()->disposableEmailAddressDetector(); $result = $deaDetector->isDisposable("*****@*****.**"); //the assertions: $this->assertEquals('YES', (string) $result->getDisposable()); }
public function testPing() { //setup code: $context = Context::builder()->priority(Priority::REALTIME())->build(); $myApiKey = 'test'; //grab one from nameapi.org $serviceFactory = new ServiceFactory($myApiKey, $context, Host::http('rc50-api.nameapi.org'), '5.0'); //the call: $pingService = $serviceFactory->systemServices()->ping(); $result = $pingService->ping(); //the assertions: $this->assertEquals('pong', $result); }