-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
31 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,18 @@ | |
|
||
namespace Velhron\DadataBundle\Tests\Service; | ||
|
||
use Velhron\DadataBundle\Service\DadataClean; | ||
|
||
class DadataCleanTest extends DadataServiceTest | ||
{ | ||
protected function createService(string $mockFilepath): DadataClean | ||
{ | ||
return new DadataClean('', '', $this->resolver, $this->getMockHttpClient($mockFilepath)); | ||
} | ||
|
||
public function testCleanAddress(): void | ||
{ | ||
$service = $this->createCleanService(__DIR__.'/../Mock/Clean/address.json'); | ||
$service = $this->createService(__DIR__.'/../mocks/Clean/address.json'); | ||
$result = $service->cleanAddress('мск сухонска 11/-89'); | ||
|
||
$this->assertEquals(0, $result->qc); | ||
|
@@ -18,7 +25,7 @@ public function testCleanAddress(): void | |
|
||
public function testCleanPhone(): void | ||
{ | ||
$service = $this->createCleanService(__DIR__.'/../Mock/Clean/phone.json'); | ||
$service = $this->createService(__DIR__.'/../mocks/Clean/phone.json'); | ||
$result = $service->cleanPhone('раб 846)231.60.14 *139'); | ||
|
||
$this->assertEquals('+7 846 231-60-14 доб. 139', $result->phone); | ||
|
@@ -27,7 +34,7 @@ public function testCleanPhone(): void | |
|
||
public function testCleanPassport(): void | ||
{ | ||
$service = $this->createCleanService(__DIR__.'/../Mock/Clean/passport.json'); | ||
$service = $this->createService(__DIR__.'/../mocks/Clean/passport.json'); | ||
$result = $service->cleanPassport('4509 235857'); | ||
|
||
$this->assertEquals('45 09', $result->series); | ||
|
@@ -36,23 +43,23 @@ public function testCleanPassport(): void | |
|
||
public function testCleanBirthdate(): void | ||
{ | ||
$service = $this->createCleanService(__DIR__.'/../Mock/Clean/birthdate.json'); | ||
$service = $this->createService(__DIR__.'/../mocks/Clean/birthdate.json'); | ||
$result = $service->cleanBirthdate('24/3/12'); | ||
|
||
$this->assertEquals('24.03.2012', $result->birthdate); | ||
} | ||
|
||
public function testCleanVehicle(): void | ||
{ | ||
$service = $this->createCleanService(__DIR__.'/../Mock/Clean/vehicle.json'); | ||
$service = $this->createService(__DIR__.'/../mocks/Clean/vehicle.json'); | ||
$result = $service->cleanVehicle('бмв'); | ||
|
||
$this->assertEquals('BMW', $result->brand); | ||
} | ||
|
||
public function testCleanName(): void | ||
{ | ||
$service = $this->createCleanService(__DIR__.'/../Mock/Clean/name.json'); | ||
$service = $this->createService(__DIR__.'/../mocks/Clean/name.json'); | ||
$result = $service->cleanName('Срегей владимерович иванов'); | ||
|
||
$this->assertEquals('Иванов', $result->surname); | ||
|
@@ -62,7 +69,7 @@ public function testCleanName(): void | |
|
||
public function testCleanEmail(): void | ||
{ | ||
$service = $this->createCleanService(__DIR__.'/../Mock/Clean/email.json'); | ||
$service = $this->createService(__DIR__.'/../mocks/Clean/email.json'); | ||
$result = $service->cleanEmail('serega@yandex/ru'); | ||
|
||
$this->assertEquals('[email protected]', $result->email); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters