From e1675d1e63b37bd9f7ebaeba87e718a660834a4c Mon Sep 17 00:00:00 2001 From: Karl Date: Sat, 25 Jul 2015 14:31:12 -0500 Subject: [PATCH] Adding test to company parsing --- tests/src/CareercastTest.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/src/CareercastTest.php b/tests/src/CareercastTest.php index adb0930..1040d99 100644 --- a/tests/src/CareercastTest.php +++ b/tests/src/CareercastTest.php @@ -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); @@ -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(),