Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #916 from YerlenZhubangaliyev/master
Browse files Browse the repository at this point in the history
kk_KZ Company/person identification numbers unit tests
  • Loading branch information
fzaninotto committed Nov 29, 2016
2 parents 73bb74d + 66d3d86 commit 9722bbe
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Faker/Provider/kk_KZ/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function companyNameSuffix()
/**
* National Business Identification Numbers
*
* @link http://egov.kz/wps/portal/!utWCM/p/b1/04_Sj9Q1MjAwsDQ1s9CP0I_KSyzLTE8syczPS8wB8aPM4oO8PE2cnAwdDSxMw4wMHE08nZ2CA0KDXcwMgQoikRUYWIY4gxS4hwU4mRkbGBgTp98AB3A0IKQ_XD8KVQkWF4AV4LHCzyM_N1U_uKhUPzcqx83SU9cRANth_Rk!/dl4/d5/L0lHSkovd0RNQU5rQUVnQSEhLzRKVUUvZW4!/
* @link http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fbus_business%2Ffor_businessmen%2Farticle%2Fbusiness_identification_number&lang=en
* @param \DateTime $registrationDate
* @return string 12 digits, like 150140000019
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Faker/Provider/kk_KZ/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class Person extends \Faker\Provider\Person
/**
* National Individual Identification Numbers
*
* @link http://egov.kz/wps/portal/!utWCM/p/b1/04_Sj9S1tDAwMzY1NjLTj9CPykssy0xPLMnMz0vMAfGjzOKDvDxNnJwMHQ0sTMOMDBxNPJ2dggNCg13MDIEKIpEVGFiGOIMUuIcFOJkZGxgYE6ffAAdwNCCkP1w_ClUJFheAFeCxws8jPzdVPzcqx83SU9cRADxWbyg!/dl4/d5/L0lDUmlTUSEhL3dHa0FKRnNBLzRKVXFDQSEhL2Vu/
* @link http://egov.kz/wps/portal/Content?contentPath=%2Fegovcontent%2Fcitizen_migration%2Fpassport_id_card%2Farticle%2Fiin_info&lang=en
* @param \DateTime $birthDate
* @return string 12 digits, like 780322300455
*/
Expand Down
31 changes: 31 additions & 0 deletions test/Faker/Provider/kk_KZ/CompanyTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
namespace Faker\Test\Provider\kk_KZ;

use Faker\Generator;
use Faker\Provider\kk_KZ\Company;

class CompanyTest extends \PHPUnit_Framework_TestCase
{

/**
* {@inheritdoc}
*/
public function setUp()
{
$this->faker = new Generator();

$this->faker->addProvider(new Company($this->faker));
}

public function testBusinessIdentificationNumberIsValid()
{
$registrationDate = new \DateTime('now');
$businessIdentificationNumber = $this->faker->businessIdentificationNumber($registrationDate);
$registrationDateAsString = $registrationDate->format('ym');

$this->assertRegExp(
"/^(" . $registrationDateAsString . ")([4-6]{1})([0-3]{1})(\\d{6})$/",
$businessIdentificationNumber
);
}
}
31 changes: 31 additions & 0 deletions test/Faker/Provider/kk_KZ/PersonTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
namespace Faker\Test\Provider\kk_KZ;

use Faker\Generator;
use Faker\Provider\kk_KZ\Person;

class PersonTest extends \PHPUnit_Framework_TestCase
{

/**
* {@inheritdoc}
*/
public function setUp()
{
$this->faker = new Generator();

$this->faker->addProvider(new Person($this->faker));
}

public function testIndividualIdentificationNumberIsValid()
{
$birthDate = new \DateTime('now');
$individualIdentificationNumber = $this->faker->individualIdentificationNumber($birthDate);
$birthDateAsString = $birthDate->format('ymd');

$this->assertRegExp(
"/^(" . $birthDateAsString . ")([1-6]{1})(\\d{5})$/",
$individualIdentificationNumber
);
}
}

0 comments on commit 9722bbe

Please sign in to comment.