Skip to content

Commit

Permalink
Adding test to company parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
karllhughes committed Jul 25, 2015
1 parent b2bd66e commit e1675d1
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/src/CareercastTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,24 @@ public function testItCanCreateJobFromPayload()

$results = $this->client->createJobObject($payload);

$this->assertEquals($payload['title'], $results->title);
$this->assertEquals($payload['description'], $results->description);
$this->assertEquals($payload['link'], $results->url);
$this->assertNotNull($results->company);
$this->assertInstanceOf('DateTime', $results->datePosted);
$this->assertEquals($city.', '.$state, $results->location);
}

public function testItCanCreateJobFromPayloadWithoutCompanyInDescription()
{
$city = uniqid();
$state = uniqid();
$this->client->setCity($city);
$this->client->setState($state);
$payload = $this->createJobArrayWithoutCompany();

$results = $this->client->createJobObject($payload);

$this->assertEquals($payload['title'], $results->title);
$this->assertEquals($payload['description'], $results->description);
$this->assertEquals($payload['link'], $results->url);
Expand Down Expand Up @@ -247,6 +265,15 @@ public function testItCanConnect()
}

private function createJobArray() {
return [
'title' => uniqid(),
'description' => uniqid().' - '.uniqid().' '.uniqid(),
'link' => uniqid(),
'pubDate' => date('F j, Y, g:i a'),
];
}

private function createJobArrayWithoutCompany() {
return [
'title' => uniqid(),
'description' => uniqid(),
Expand Down

0 comments on commit e1675d1

Please sign in to comment.