From d7a9fb4ba6d33770c98a722c13a0884046d4343e Mon Sep 17 00:00:00 2001 From: muskie9 Date: Fri, 16 Jan 2015 14:22:18 -0600 Subject: [PATCH] Add LocationTest and travis support --- .travis.yml | 32 +++++++++++++++++++++++++++++ composer.json | 3 ++- tests/LocationTest.php | 46 ++++++++++++++++++++++++++++++++++++++++++ tests/LocatorTest.php | 24 ++++++++++++++++++++++ tests/LocatorTest.yml | 24 ++++++++++++++++++++++ 5 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 .travis.yml create mode 100644 tests/LocationTest.php create mode 100644 tests/LocatorTest.php create mode 100644 tests/LocatorTest.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..473a942 --- /dev/null +++ b/.travis.yml @@ -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= diff --git a/composer.json b/composer.json index 0440195..3a510a3 100644 --- a/composer.json +++ b/composer.json @@ -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." diff --git a/tests/LocationTest.php b/tests/LocationTest.php new file mode 100644 index 0000000..1e7f044 --- /dev/null +++ b/tests/LocationTest.php @@ -0,0 +1,46 @@ +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)); + + } + + +} \ No newline at end of file diff --git a/tests/LocatorTest.php b/tests/LocatorTest.php new file mode 100644 index 0000000..4beee23 --- /dev/null +++ b/tests/LocatorTest.php @@ -0,0 +1,24 @@ +session()->clear('loggedInAs'); + $this->session()->clear('logInWithPermission'); + } + + public function testLocator(){} + +} diff --git a/tests/LocatorTest.yml b/tests/LocatorTest.yml new file mode 100644 index 0000000..0a5f6ef --- /dev/null +++ b/tests/LocatorTest.yml @@ -0,0 +1,24 @@ +Locator: + locator1: + Title: Locator +Location: + dynamic: + Title: Dynamic Inc. + Featured: true + Website: http://dynamicdoes.com + Phone: 920-459-8889 + EmailAddress: info@dynamicdoes.com + ShowInLocator: true + silverstripe: + Title: Silverstripe + Featured: true + Website: http://silverstripe.org + Phone: 555-555-5555 + EmailAddress: solutions@silverstripe.com + ShowInLocator: true + 3sheeps: + Title: 3 Sheeps Brewing + Featured: false + Website: http://3sheepsbrewing.com + Phone: 555-555-5556 + ShowInLocator: false \ No newline at end of file