diff --git a/src/Providers/MonsterProvider.php b/src/Providers/MonsterProvider.php
index 6cff5fe..34316a8 100644
--- a/src/Providers/MonsterProvider.php
+++ b/src/Providers/MonsterProvider.php
@@ -23,13 +23,8 @@ public function createJobObject($payload)
$job->setDatePostedAsString($payload['pubDate']);
// Set a location if it was set in the query
- if ($this->query && $this->query->get('l')) {
- $job->setLocation($this->query->get('l'));
- }
-
- // Set a company if it was set in the query
- if ($this->query && $this->query->get('company')) {
- $job->setCompany($this->query->get('company'));
+ if ($this->query && $this->query->get('where')) {
+ $job->setLocation($this->query->get('where'));
}
return $job;
diff --git a/tests/src/MonsterProviderTest.php b/tests/src/MonsterProviderTest.php
index edb7b0c..8319d06 100644
--- a/tests/src/MonsterProviderTest.php
+++ b/tests/src/MonsterProviderTest.php
@@ -8,6 +8,11 @@
class MonsterProviderTest extends \PHPUnit_Framework_TestCase
{
+ /**
+ * @var MonsterProvider
+ */
+ public $client;
+
public function setUp()
{
$this->query = m::mock(MonsterQuery::class);
@@ -59,13 +64,9 @@ public function testItCanCreateJobObjectWhenLocationSet()
$payload = $this->createJobArray();
$this->query->shouldReceive('get')
- ->with('l')
+ ->with('where')
->once()
->andReturn($location);
- $this->query->shouldReceive('get')
- ->with('company')
- ->once()
- ->andReturn(null);
$results = $this->client->createJobObject($payload);
@@ -77,30 +78,6 @@ public function testItCanCreateJobObjectWhenLocationSet()
$this->assertEquals($location, $results->getLocation());
}
- public function testItCanCreateJobObjectWhenCompanySet()
- {
- $company = uniqid();
- $payload = $this->createJobArray();
-
- $this->query->shouldReceive('get')
- ->with('company')
- ->once()
- ->andReturn($company);
- $this->query->shouldReceive('get')
- ->with('l')
- ->once()
- ->andReturn(null);
-
- $results = $this->client->createJobObject($payload);
-
- $this->assertInstanceOf(Job::class, $results);
- $this->assertEquals($payload['title'], $results->getTitle());
- $this->assertEquals($payload['title'], $results->getName());
- $this->assertEquals($payload['description'], $results->getDescription());
- $this->assertEquals($payload['link'], $results->getUrl());
- $this->assertEquals($company, $results->getCompany());
- }
-
/**
* Integration test for the client's getJobs() method.
*/
@@ -108,15 +85,15 @@ public function testItCanGetJobs()
{
$options = [
'q' => uniqid(),
- 'l' => uniqid(),
- 't' => uniqid(),
+ 'where' => uniqid(),
+ 'page' => rand(1,5),
];
$guzzle = m::mock('GuzzleHttp\Client');
- $query = new JobinventoryQuery($options);
+ $query = new MonsterQuery($options);
- $client = new JobinventoryProvider($query);
+ $client = new MonsterProvider($query);
$client->setClient($guzzle);
@@ -148,12 +125,14 @@ public function testItCanGetJobsFromApi()
}
$keyword = 'engineering';
+ $location = 'chicago, il';
- $query = new JobinventoryQuery([
+ $query = new MonsterQuery([
'q' => $keyword,
+ 'where' => $location,
]);
- $client = new JobinventoryProvider($query);
+ $client = new MonsterProvider($query);
$results = $client->getJobs();
@@ -161,6 +140,7 @@ public function testItCanGetJobsFromApi()
foreach($results as $job) {
$this->assertEquals($keyword, $job->query);
+ $this->assertEquals($location, $job->location);
}
}
@@ -176,6 +156,6 @@ private function createJobArray()
private function createXmlResponse()
{
- return "Hotel Jobs in Chicago, IL // JobInventory.comHotel Specialist Agentshttp://www.jobinventory.com/d/Hotel-Specialist-Agents-Jobs-Chicago-IL-1391153840.htmlFull-time/Regular 9:00 AM to 6:00 PM. 40 hours per week. (Overtime as required) The hotel ... Specialist Agents would pre pay all hotel rooms and help support the reservations team. JOB OVERVIEW work2015-04-11 00:48:39Maintenance_Hourly1http://www.jobinventory.com/d/Maintenance_hourly1-Jobs-Chicago-IL-1583775509.htmlData not provided2016-05-17 18:13:26";
+ return "Hotel Jobs in Chicago, IL // JobInventory.comHotel Specialist Agentshttp://www.jobinventory.com/d/Hotel-Specialist-Agents-Jobs-Chicago-IL-1391153840.htmlFull-time/Regular 9:00 AM to 6:00 PM. 40 hours per week. (Overtime as required) The hotel ... Specialist Agents would pre pay all hotel rooms and help support the reservations team. JOB OVERVIEW work2015-04-11 00:48:39Maintenance_Hourly1http://www.jobinventory.com/d/Maintenance_hourly1-Jobs-Chicago-IL-1583775509.htmlData not provided2016-05-17 18:13:26";
}
}