Skip to content

Commit

Permalink
Adding a couple of extra tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JustSteveKing committed May 7, 2021
1 parent d194357 commit 123919f
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/CompaniesHouseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,25 @@ public function it_can_build_a_client_to_make_calls()
);
}

/**
* @test
*/
public function it_can_make_a_client()
{
$client = Client::make(
url: config('companies-house.api.url'),
apiKey: config('companies-house.api.key'),
timeout: (int) config('companies-house.api.timeout'),
retryTimes: (int) config('companies-house.api.retry.times'),
retryMilliseconds: (int) config('companies-house.api.retry.milliseconds'),
);

$this->assertInstanceOf(
expected: Client::class,
actual: $client,
);
}

/**
* @test
*/
Expand Down Expand Up @@ -172,12 +191,19 @@ public function it_fails_when_using_the_rule_macro()
{
$number = 'quite_obviously_fake';

$rule = Rule::companyNumber();

$this->assertFalse(
condition: Rule::companyNumber()->passes(
condition: $rule->passes(
attributes: 'test',
value: $number,
),
);

$this->assertEquals(
expected: 'The submitted company number is not a valid UK company number.',
actual: $rule->message(),
);
}

/**
Expand Down

0 comments on commit 123919f

Please sign in to comment.