diff --git a/composer.json b/composer.json index 1bbcb79..5fd8ae8 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,8 @@ "license": "BSD-3-Clause", "homepage": "https://github.com/silverstripe/workable/", "require": { - "silverstripe/framework": ">=3.1.0" + "silverstripe/framework": ">=3.1.0", + "php": ">=5.4" }, "authors":[ { diff --git a/tests/WorkableTest.php b/tests/WorkableTest.php index 34ae9f9..0a3e224 100644 --- a/tests/WorkableTest.php +++ b/tests/WorkableTest.php @@ -3,6 +3,7 @@ class WorkableTest extends SapphireTest { public function setUp() { + parent::setUp(); $config = Config::inst()->get('Injector','WorkableRestfulService'); $config['class'] = 'TestWorkableRestfulService'; Config::inst()->update('Injector','WorkableRestfulService', $config); @@ -11,13 +12,6 @@ public function setUp() { Config::inst()->update('Workable', 'subdomain', 'example'); } - // public function testThrowsIfNoAPIKey () { - // Config::inst()->remove('Workable','apiKey'); - // $this->setExpectedException('RuntimeException'); - - // Workable::create(); - // } - public function testThrowsIfNoSubdomain () { Config::inst()->remove('Workable','subdomain'); $this->setExpectedException('RuntimeException'); @@ -37,15 +31,15 @@ public function testWillUseAPIKeyConstant () { public function testGetsPublishedJobs () { $result = Workable::create()->getJobs(['state' => 'published']); - $this->assertEquals($result->count(), 3); - $this->assertEquals($result->first()->Title, 'Published Job 1'); + $this->assertEquals(3, $result->count()); + $this->assertEquals('Published Job 1', $result->first()->Title); } public function testGetsUnpublishedJobs () { $result = Workable::create()->getJobs(['state' => 'draft']); - $this->assertEquals($result->count(), 1); - $this->assertEquals($result->first()->Title, 'Draft Job 1'); + $this->assertEquals(1, $result->count()); + $this->assertEquals('Draft Job 1', $result->first()->Title); } public function testLogsError () { @@ -54,18 +48,20 @@ public function testLogsError () { $result = Workable::create()->getJobs(['state' => 'fail']); $this->assertNotNull($logger->event); + + SS_Log::remove_writer($logger); } public function testConvertsSnakeCase () { $data = new Workable_Result(['snake_case' => 'foo']); - $this->assertEquals($data->SnakeCase, 'foo'); + $this->assertEquals('foo', $data->SnakeCase); } public function testAcceptsDotSyntax () { $data = new Workable_Result(['snake_case' => ['nested_property' => 'foo']]); $result = $data->SnakeCase; $this->assertInstanceOf('Workable_Result', $result); - $this->assertEquals($result->NestedProperty, 'foo'); + $this->assertEquals('foo', $result->NestedProperty); } } \ No newline at end of file