Skip to content

Commit

Permalink
Merge 6155ca0 into acf4306
Browse files Browse the repository at this point in the history
  • Loading branch information
levelfivehub committed Jan 24, 2020
2 parents acf4306 + 6155ca0 commit 5851c43
Show file tree
Hide file tree
Showing 16 changed files with 491 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ language: php
sudo: false

php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"require": {
"laminas/laminas-validator": "^2.13",
"php": "^7.3",
"php": "^7.0",
"ext-json": "*",
"guzzlehttp/guzzle": "^6.3",
"league/tactician": "^1.0",
Expand Down
18 changes: 9 additions & 9 deletions src/Entity/Common/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,71 +75,71 @@ public function __construct($response)
/**
* @return string
*/
public function getFirstLine(): string
public function getFirstLine():? string
{
return $this->firstLine;
}

/**
* @return string
*/
public function getSecondLine(): string
public function getSecondLine():? string
{
return $this->secondLine;
}

/**
* @return string
*/
public function getLocality(): string
public function getLocality():? string
{
return $this->locality;
}

/**
* @return string
*/
public function getRegion(): string
public function getRegion():? string
{
return $this->region;
}

/**
* @return string
*/
public function getPostalCode(): string
public function getPostalCode():? string
{
return $this->postalCode;
}

/**
* @return string
*/
public function getCountry(): string
public function getCountry():? string
{
return $this->country;
}

/**
* @return string
*/
public function getPoBox(): string
public function getPoBox():? string
{
return $this->poBox;
}

/**
* @return string
*/
public function getPremises(): string
public function getPremises():? string
{
return $this->premises;
}

/**
* @return string
*/
public function getCareOf(): string
public function getCareOf():? string
{
return $this->careOf;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Entity/Common/DateOfBirth.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,31 @@ public function __construct($response)
/**
* @return int
*/
public function getDay(): int
public function getDay():? int
{
return $this->day;
}

/**
* @return int
*/
public function getMonth(): int
public function getMonth():? int
{
return $this->month;
}

/**
* @return int
*/
public function getYear(): int
public function getYear():? int
{
return $this->year;
}

/**
* @return string
*/
public function getDateOfBirth(): string
public function getDateOfBirth():? string
{
return $this->day . '/' . $this->month . '/' . $this->year;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Entity/Common/Identification.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,39 +47,39 @@ public function __construct($response)
/**
* @return string
*/
public function getIdentificationType(): ?string
public function getIdentificationType():? string
{
return $this->identificationType;
}

/**
* @return string
*/
public function getLegalAuthority(): ?string
public function getLegalAuthority():? string
{
return $this->legalAuthority;
}

/**
* @return string
*/
public function getLegalForm(): ?string
public function getLegalForm():? string
{
return $this->legalForm;
}

/**
* @return string
*/
public function getPlaceRegistered(): ?string
public function getPlaceRegistered():? string
{
return $this->placeRegistered;
}

/**
* @return string
*/
public function getRegistrationNumber(): ?string
public function getRegistrationNumber():? string
{
return $this->registrationNumber;
}
Expand Down
16 changes: 8 additions & 8 deletions src/Entity/Common/Officer.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __construct($response)
$this->address = new Address($response->offsetGet('address'));
$this->appointedOn = $response->offsetGet('appointed_on');
$this->countryOfResidence = $response->offsetGet('country_of_residence');
$this->dateOfBirth = new DateOfBirth($response->offsetGet('region'));
$this->dateOfBirth = new DateOfBirth($response->offsetGet('date_of_birth'));
$this->name = $response->offsetGet('name');
$this->nationality = $response->offsetGet('nationality');
$this->occupation = $response->offsetGet('occupation');
Expand Down Expand Up @@ -97,55 +97,55 @@ public function getDateOfBirth(): DateOfBirth
/**
* @return string
*/
public function getAppointedOn(): string
public function getAppointedOn(): ?string
{
return $this->appointedOn;
}

/**
* @return string
*/
public function getCountryOfResidence(): string
public function getCountryOfResidence(): ?string
{
return $this->countryOfResidence;
}

/**
* @return string
*/
public function getName(): string
public function getName(): ?string
{
return $this->name;
}

/**
* @return string
*/
public function getNationality(): string
public function getNationality(): ?string
{
return $this->nationality;
}

/**
* @return string
*/
public function getOccupation(): string
public function getOccupation(): ?string
{
return $this->occupation;
}

/**
* @return string
*/
public function getOfficerRole(): string
public function getOfficerRole(): ?string
{
return $this->officerRole;
}

/**
* @return string
*/
public function getResignedOn(): string
public function getResignedOn(): ?string
{
return $this->resignedOn;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Entity/Company/GetCompany.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function __construct($response)
$this->companyStatus = $response->offsetGet('company_status');
$this->companyStatusDetail = $response->offsetGet('company_status_detail');
$this->dateOfCessation = $response->offsetGet('date_of_cessation');
$this->dateOfCreation = $response->offsetGet('date_of_crreation');
$this->dateOfCreation = $response->offsetGet('date_of_creation');
$this->etag = $response->offsetGet('etag');
$this->externalRegistrationNumber = $response->offsetGet('external_registration_number');

Expand Down Expand Up @@ -251,17 +251,17 @@ public function isAccountsOverdue(): bool
}

/**
* @return \DateTimeImmutable
* @return string
*/
public function getAccountsNextDue(): \DateTimeImmutable
public function getAccountsNextDue():? string
{
return $this->accountsNextDue;
}

/**
* @return \DateTimeImmutable
* @return string
*/
public function getAccountsNextMadeUpTo(): \DateTimeImmutable
public function getAccountsNextMadeUpTo():? string
{
return $this->accountsNextMadeUpTo;
}
Expand Down
37 changes: 37 additions & 0 deletions tests/Entity/Common/AddressTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
namespace Test\Entity\Common;

use LevelFive\CompaniesHouse\Entity\Common\Address;
use PHPStan\Testing\TestCase;

class AddressTest extends TestCase
{
public function testAddress()
{
$response = [
'address_line_1' => '10 Downing Street',
'address_line_2' => 'London',
'locality' => 'London.',
'region' => 'Greater London',
'postal_code' => 'SW1 3WQ',
'country' => 'United Kingdom',
'po_box' => 'POBOX 1003',
'premises' => 'Building',
'care_of' => 'test',
];

$address = new Address($response);

self::assertEquals($response['address_line_1'], $address->getFirstLine());
self::assertEquals($response['address_line_2'], $address->getSecondLine());
self::assertEquals($response['locality'], $address->getLocality());
self::assertEquals($response['region'], $address->getRegion());
self::assertEquals($response['postal_code'], $address->getPostalCode());
self::assertEquals($response['country'], $address->getCountry());
self::assertEquals($response['po_box'], $address->getPoBox());
self::assertEquals($response['premises'], $address->getPremises());
self::assertEquals($response['care_of'], $address->getCareOf());

self::assertEquals($response, $address->getRawResponse());
}
}
24 changes: 24 additions & 0 deletions tests/Entity/Common/DateOfBirthTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
namespace Test\Entity\Common;

use LevelFive\CompaniesHouse\Entity\Common\DateOfBirth;
use PHPStan\Testing\TestCase;

class DateOfBirthTest extends TestCase
{
public function testDateOfBirth()
{
$response = [
'day' => '21',
'month' => '03',
'year' => '1979',
];

$dateOfBirth = new DateOfBirth($response);

self::assertEquals($response['day'], $dateOfBirth->getDay());
self::assertEquals($response['month'], $dateOfBirth->getMonth());
self::assertEquals($response['year'], $dateOfBirth->getYear());
self::assertEquals('21/03/1979', $dateOfBirth->getDateOfBirth());
}
}
28 changes: 28 additions & 0 deletions tests/Entity/Common/IdentificationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
namespace Test\Entity\Common;

use LevelFive\CompaniesHouse\Entity\Common\Identification;
use PHPStan\Testing\TestCase;

class IdentificationTest extends TestCase
{
public function testIdentification()
{
$response = [
'identification_type' => 'passport',
'legal_authority' => 'UK',
'legal_form' => 'EN11',
'place_registered' => 'London',
'registration_number' => '123123123213',
];

$identification = new Identification($response);

self::assertEquals($response['identification_type'], $identification->getIdentificationType());
self::assertEquals($response['legal_authority'], $identification->getLegalAuthority());
self::assertEquals($response['legal_form'], $identification->getLegalForm());
self::assertEquals($response['place_registered'], $identification->getPlaceRegistered());
self::assertEquals($response['registration_number'], $identification->getRegistrationNumber());

}
}

0 comments on commit 5851c43

Please sign in to comment.