Skip to content

Commit

Permalink
new php constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
Uncle Cheese committed Sep 10, 2015
1 parent 4cf828e commit cf3ba59
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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":[
{
Expand Down
22 changes: 9 additions & 13 deletions tests/WorkableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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');
Expand All @@ -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 () {
Expand All @@ -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);
}
}

0 comments on commit cf3ba59

Please sign in to comment.