Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LocationTest and travis support #47

Merged
merged 1 commit into from
Jan 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
language: php
php:
- 5.3

env:
matrix:
#- DB=MYSQL CORE_RELEASE=3.0
- DB=MYSQL CORE_RELEASE=3.1
#- DB=MYSQL CORE_RELEASE=master
- DB=PGSQL CORE_RELEASE=3.1

matrix:
include:
- php: 5.4
env: DB=MYSQL CORE_RELEASE=3.1
- php: 5.5
env: DB=MYSQL CORE_RELEASE=3.1
- php: 5.6
env: DB=MYSQL CORE_RELEASE=3.1
#env: DB=MYSQL CORE_RELEASE=master

before_script:
- phpenv rehash
- git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support
- php ~/travis-support/travis_setup.php --source `pwd` --target ~/builds/ss
- cd ~/builds/ss

script:
- vendor/bin/phpunit locator/tests/
notifications:
slack:
secure: EsA1gihJJ+/q7LWH+C5ipRx4Izi49e9ekGf4/0HL0bD4np/BGSRsh8/bBwOhYOLSi2RJTZzl62ALO0J2gjkwMyvrT41jmpVFYYFBEer5D3f5KEa8otq+Z0yHNxUwIMVbqg48fQU8L0TAPBUHSiABjMyTJAbEfemy7Q2oRmCtFiU=
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
],
"require": {
"silverstripe/framework": "3.1.*",
"ajshort/silverstripe-addressable": "*"
"silverstripe/cms": "3.1.*",
"silverstripe-australia/addressable": "*"
},
"suggest": {
"unclecheese/betterbuttons": "Adds new form actions and buttons to GridField detail form for usability enhancements."
Expand Down
46 changes: 46 additions & 0 deletions tests/LocationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

class LocationTest extends LocatorTest{

protected static $use_draft_site = true;

function setUp(){
parent::setUp();
}

function testLocationCreation(){

$this->logInWithPermission('Location_CREATE');
$location = $this->objFromFixture('Location', 'dynamic');

$this->assertTrue($location->canCreate());

$locationID = $location->ID;

$this->assertTrue($locationID > 0);

$getLocal = Location::get()->byID($locationID);
$this->assertTrue($getLocal->ID == $locationID);

}

function testLocationDeletion(){

$this->logInWithPermission('ADMIN');
$location = $this->objFromFixture('Location', 'silverstripe');
$locationID = $location->ID;

$this->logOut();

$this->logInWithPermission('Location_DELETE');

$this->assertTrue($location->canDelete());
$location->delete();

$locations = Location::get()->column('ID');
$this->assertFalse(in_array($locationID, $locations));

}


}
24 changes: 24 additions & 0 deletions tests/LocatorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

class LocatorTest extends FunctionalTest{

protected static $fixture_file = 'locator/tests/LocatorTest.yml';
protected static $disable_themes = true;
protected static $use_draft_site = false;

public function setUp(){
parent::setUp();

ini_set('display_errors', 1);
ini_set("log_errors", 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
}

public function logOut(){
$this->session()->clear('loggedInAs');
$this->session()->clear('logInWithPermission');
}

public function testLocator(){}

}
24 changes: 24 additions & 0 deletions tests/LocatorTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Locator:
locator1:
Title: Locator
Location:
dynamic:
Title: Dynamic Inc.
Featured: true
Website: http://dynamicdoes.com
Phone: 920-459-8889
EmailAddress: [email protected]
ShowInLocator: true
silverstripe:
Title: Silverstripe
Featured: true
Website: http://silverstripe.org
Phone: 555-555-5555
EmailAddress: [email protected]
ShowInLocator: true
3sheeps:
Title: 3 Sheeps Brewing
Featured: false
Website: http://3sheepsbrewing.com
Phone: 555-555-5556
ShowInLocator: false