From c8906cb12d59c74136a2ef0c1820b1cd57939651 Mon Sep 17 00:00:00 2001 From: Jason Irish Date: Thu, 7 Apr 2016 16:56:23 -0500 Subject: [PATCH] PSR2-2 formatting --- code/LocationCategory.php | 6 +++--- code/Locator.php | 4 +++- tests/LocatorTest.php | 3 +-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/code/LocationCategory.php b/code/LocationCategory.php index 283ce3d..c3c2411 100644 --- a/code/LocationCategory.php +++ b/code/LocationCategory.php @@ -11,11 +11,11 @@ class LocationCategory extends DataObject ); private static $belogs_many_many = array( - 'Locators' => 'Locator' + 'Locators' => 'Locator', ); - private static $singular_name = "Category"; - Private static $plural_name = "Categories"; + private static $singular_name = 'Category'; + private static $plural_name = 'Categories'; private static $default_sort = 'Name'; } diff --git a/code/Locator.php b/code/Locator.php index e11ad76..b166899 100644 --- a/code/Locator.php +++ b/code/Locator.php @@ -77,11 +77,13 @@ public function getAllCategories() public static function getPageCategories($id = null) { if ($id) { - if ($locator = Locator::get()->byID($id)) { + if ($locator = self::get()->byID($id)) { return $locator->Categories(); } + return false; } + return false; } } diff --git a/tests/LocatorTest.php b/tests/LocatorTest.php index e7169f2..4858ae9 100644 --- a/tests/LocatorTest.php +++ b/tests/LocatorTest.php @@ -56,7 +56,7 @@ public function testLocationSearch() $object = Locator_Controller::create($locator); $form = $object->LocationSearch(); $this->assertTrue(is_a($form, 'Form')); - + $category = $this->objFromFixture('LocationCategory', 'service'); $category2 = $this->objFromFixture('LocationCategory', 'manufacturing'); $locator->Categories()->add($category); @@ -65,6 +65,5 @@ public function testLocationSearch() $form = $object->LocationSearch(); $fields = $form->Fields(); $this->assertNotNull($fields->fieldByName('category')); - } }