Skip to content

Commit

Permalink
Replace deprecated methods with their replacements
Browse files Browse the repository at this point in the history
Signed-off-by: Ghazanfar Mir <[email protected]>
  • Loading branch information
GhazanfarMir committed Aug 6, 2019
1 parent 0167bfc commit a6e86a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 2 additions & 0 deletions tests/Features/CompaniesHouseBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ public function setUp(): void
$this->api = new CompaniesHouse($this->client);

$this->platform = getenv('PLATFORM');

$this->assertTrue(true);
}
}
24 changes: 15 additions & 9 deletions tests/Features/CompanyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace GhazanfarMir\CompaniesHouse\Tests\Features;

use GhazanfarMir\CompaniesHouse\Exceptions\InvalidResourceException;

class CompanyTest extends CompaniesHouseBaseTest
{
/**
Expand All @@ -22,9 +24,9 @@ public function get_company_profile_by_company_number()

$companies = $this->api->company($this->number)->get();

$this->assertArrayHasKey('company_name', (array) $companies);
$this->assertArrayHasKey('company_name', (array)$companies);

$this->assertArrayHasKey('company_status', (array) $companies);
$this->assertArrayHasKey('company_status', (array)$companies);
}

/**
Expand All @@ -38,7 +40,7 @@ public function get_company_registered_address()
return;
}

$address = (array) $this->api->company($this->number)->registered_office_address();
$address = (array)$this->api->company($this->number)->registered_office_address();

$this->assertArrayHasKey('postal_code', $address);
$this->assertArrayHasKey('country', $address);
Expand All @@ -60,9 +62,9 @@ public function get_company_officers()

$officers = $this->api->company($this->number)->officers();

$this->assertArrayHasKey('total_results', (array) $officers);
$this->assertArrayHasKey('name', (array) $officers->items[0]);
$this->assertArrayHasKey('address', (array) $officers->items[0]);
$this->assertArrayHasKey('total_results', (array)$officers);
$this->assertArrayHasKey('name', (array)$officers->items[0]);
$this->assertArrayHasKey('address', (array)$officers->items[0]);
}

/**
Expand All @@ -78,30 +80,34 @@ public function get_uk_establishment_companies()

$establishments = $this->api->company($this->number)->uk_establishments();

$this->assertArrayHasKey('items', (array) $establishments);
$this->assertArrayHasKey('items', (array)$establishments);
}

/**
* @expectedException \GhazanfarMir\CompaniesHouse\Exceptions\InvalidResourceException
* @test
*/
public function get_company_registers()
{
$this->expectException(InvalidResourceException::class);

if ($this->platform == 'travis') {
throw new \GhazanfarMir\CompaniesHouse\Exceptions\InvalidResourceException;


return;
}

$this->api->company($this->number)->registers();
}

/**
* @expectedException \GhazanfarMir\CompaniesHouse\Exceptions\InvalidResourceException
* @test
*/
public function get_company_exemptions()
{

$this->expectException(InvalidResourceException::class);

if ($this->platform == 'travis') {
throw new \GhazanfarMir\CompaniesHouse\Exceptions\InvalidResourceException;

Expand Down

0 comments on commit a6e86a9

Please sign in to comment.