From 151baeede1aa5419a34594389c629bc81eda7a03 Mon Sep 17 00:00:00 2001 From: Simon Welsh Date: Wed, 21 Aug 2013 18:54:05 +1200 Subject: [PATCH] Correct line length and indentation --- admin/tests/LeftAndMainTest.php | 6 ++-- api/XMLDataFormatter.php | 1 - cache/Cache.php | 2 +- cli-script.php | 3 +- dev/BehatFixtureFactory.php | 30 +++++++++---------- dev/CsvBulkLoader.php | 3 +- dev/SapphireTest.php | 16 ++++++++-- filesystem/ImagickBackend.php | 8 +++-- forms/CheckboxField.php | 4 ++- forms/CheckboxSetField.php | 3 +- forms/ConfirmedPasswordField.php | 2 +- forms/HtmlEditorField.php | 6 ++-- forms/ListboxField.php | 3 +- i18n/i18n.php | 6 ++-- model/Database.php | 4 +-- model/Hierarchy.php | 10 ++++--- parsers/ShortcodeParser.php | 24 +++++++++------ security/Group.php | 6 ++-- security/Security.php | 2 +- .../features/bootstrap/FeatureContext.php | 28 ++++++++--------- tests/control/HTTPTest.php | 12 +++++--- tests/core/CoreTest.php | 8 +++-- .../manifest/ConfigStaticManifestTest.php | 2 ++ tests/core/manifest/TemplateManifestTest.php | 10 +++---- tests/forms/RequirementsTest.php | 8 +++-- tests/model/HTMLTextTest.php | 3 +- tests/model/ImageTest.php | 2 +- tests/model/ValidationExceptionTest.php | 5 ++-- tests/parsers/ShortcodeParserTest.php | 5 ++-- view/SSTemplateParser.php.inc | 3 +- 30 files changed, 137 insertions(+), 88 deletions(-) diff --git a/admin/tests/LeftAndMainTest.php b/admin/tests/LeftAndMainTest.php index 23ae15fb9..9f727eb37 100644 --- a/admin/tests/LeftAndMainTest.php +++ b/admin/tests/LeftAndMainTest.php @@ -49,8 +49,10 @@ class LeftAndMainTest extends FunctionalTest { $this->session()->inst_set('loggedInAs', $admin->ID); $response = $this->get('LeftAndMainTest_Controller'); - $this->assertRegExp('/tests\/assets\/LeftAndMainTest.css/i', $response->getBody(), "body should contain custom css"); - $this->assertRegExp('/tests\/assets\/LeftAndMainTest.js/i', $response->getBody(), "body should contain custom js"); + $this->assertRegExp('/tests\/assets\/LeftAndMainTest.css/i', $response->getBody(), + "body should contain custom css"); + $this->assertRegExp('/tests\/assets\/LeftAndMainTest.js/i', $response->getBody(), + "body should contain custom js"); } /** diff --git a/api/XMLDataFormatter.php b/api/XMLDataFormatter.php index 40a1bb81d..1b958494e 100644 --- a/api/XMLDataFormatter.php +++ b/api/XMLDataFormatter.php @@ -96,7 +96,6 @@ class XMLDataFormatter extends DataFormatter { $items = $obj->$relName(); if ($items) { foreach($items as $item) { - //$href = Director::absoluteURL($this->config()->api_base . "$className/$id/$relName/$item->ID"); $href = Director::absoluteURL($this->config()->api_base . "$relClass/$item->ID"); $xml .= "<$relClass href=\"$href.xml\" id=\"{$item->ID}\">\n"; } diff --git a/cache/Cache.php b/cache/Cache.php index 71d70061a..99c5885b1 100644 --- a/cache/Cache.php +++ b/cache/Cache.php @@ -257,7 +257,7 @@ class SS_Cache { foreach(array('any', $for) as $name) { if(isset(self::$backend_picks[$name])) { - if(self::$backend_picks[$name]['priority'] > $backend_priority) { + if(self::$backend_picks[$name]['priority'] > $backend_priority) { $backend_name = self::$backend_picks[$name]['name']; $backend_priority = self::$backend_picks[$name]['priority']; } diff --git a/cli-script.php b/cli-script.php index 2978868fe..138352a9d 100755 --- a/cli-script.php +++ b/cli-script.php @@ -75,7 +75,8 @@ require_once("model/DB.php"); if(!isset($databaseConfig) || !isset($databaseConfig['database']) || !$databaseConfig['database']) { echo "\nPlease configure your database connection details. You can do this by creating a file called _ss_environment.php in either of the following locations:\n\n"; - echo " - " . BASE_PATH . DIRECTORY_SEPARATOR . "_ss_environment.php\n - " . dirname(BASE_PATH) . DIRECTORY_SEPARATOR . "_ss_environment.php\n\n"; + echo " - " . BASE_PATH . DIRECTORY_SEPARATOR . "_ss_environment.php\n - "; + echo dirname(BASE_PATH) . DIRECTORY_SEPARATOR . "_ss_environment.php\n\n"; echo <<hasField($fieldName) && !isset($data[$fieldName])) { - $data[$fieldName] = $identifier; - break; - } - } - } + // Copy identifier to some visible property unless its already defined. + // Exclude files, since they generate their own named based on the file path. + if(!$name != 'File' && !is_subclass_of($name, 'File')) { + foreach(array('Name', 'Title') as $fieldName) { + if(singleton($name)->hasField($fieldName) && !isset($data[$fieldName])) { + $data[$fieldName] = $identifier; + break; + } + } + } - return parent::createObject($name, $identifier, $data); - } -} \ No newline at end of file + return parent::createObject($name, $identifier, $data); + } +} diff --git a/dev/CsvBulkLoader.php b/dev/CsvBulkLoader.php index d5fb50545..173d847dd 100644 --- a/dev/CsvBulkLoader.php +++ b/dev/CsvBulkLoader.php @@ -210,7 +210,8 @@ class CsvBulkLoader extends BulkLoader { if(is_string($duplicateCheck)) { $SQL_fieldName = Convert::raw2sql($duplicateCheck); - if(!isset($record[$SQL_fieldName]) || empty($record[$SQL_fieldName])) { //skip current duplicate check if field value is empty + if(!isset($record[$SQL_fieldName]) || empty($record[$SQL_fieldName])) { + //skip current duplicate check if field value is empty continue; } diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index 2e29b7d79..e13b4c518 100644 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -501,12 +501,24 @@ class SapphireTest extends PHPUnit_Framework_TestCase { } } - public static function assertContains($needle, $haystack, $message = '', $ignoreCase = FALSE, $checkForObjectIdentity = TRUE) { + public static function assertContains( + $needle, + $haystack, + $message = '', + $ignoreCase = FALSE, + $checkForObjectIdentity = TRUE + ) { if ($haystack instanceof DBField) $haystack = (string)$haystack; parent::assertContains($needle, $haystack, $message, $ignoreCase, $checkForObjectIdentity); } - public static function assertNotContains($needle, $haystack, $message = '', $ignoreCase = FALSE, $checkForObjectIdentity = TRUE) { + public static function assertNotContains( + $needle, + $haystack, + $message = '', + $ignoreCase = FALSE, + $checkForObjectIdentity = TRUE + ) { if ($haystack instanceof DBField) $haystack = (string)$haystack; parent::assertNotContains($needle, $haystack, $message, $ignoreCase, $checkForObjectIdentity); } diff --git a/filesystem/ImagickBackend.php b/filesystem/ImagickBackend.php index 419d0778d..9f48711e2 100644 --- a/filesystem/ImagickBackend.php +++ b/filesystem/ImagickBackend.php @@ -255,12 +255,14 @@ class ImagickBackend extends Imagick implements Image_Backend { $new->setBackgroundColor($backgroundColor); if(($geo['width']/$width) < ($geo['height']/$height)){ - $new->cropImage($geo['width'], floor($height*$geo['width']/$width), 0, (($geo['height']-($height*$geo['width']/$width))/2)); + $new->cropImage($geo['width'], floor($height*$geo['width']/$width), + 0, (($geo['height']-($height*$geo['width']/$width))/2)); }else{ - $new->cropImage(ceil($width*$geo['height']/$height), $geo['height'], (($geo['width']-($width*$geo['height']/$height))/2), 0); + $new->cropImage(ceil($width*$geo['height']/$height), $geo['height'], + (($geo['width']-($width*$geo['height']/$height))/2), 0); } $new->ThumbnailImage($width,$height,true); return $new; } } -} \ No newline at end of file +} diff --git a/forms/CheckboxField.php b/forms/CheckboxField.php index 7f0c6c814..1c07a93aa 100644 --- a/forms/CheckboxField.php +++ b/forms/CheckboxField.php @@ -56,7 +56,9 @@ class CheckboxField_Readonly extends ReadonlyField { } public function Value() { - return Convert::raw2xml($this->value ? _t('CheckboxField.YESANSWER', 'Yes') : _t('CheckboxField.NOANSWER', 'No')); + return Convert::raw2xml($this->value ? + _t('CheckboxField.YESANSWER', 'Yes') : + _t('CheckboxField.NOANSWER', 'No')); } } diff --git a/forms/CheckboxSetField.php b/forms/CheckboxSetField.php index 6e694a924..c4bed6cbe 100644 --- a/forms/CheckboxSetField.php +++ b/forms/CheckboxSetField.php @@ -181,7 +181,8 @@ class CheckboxSetField extends OptionsetField { public function saveInto(DataObjectInterface $record) { $fieldname = $this->name; $relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null; - if($fieldname && $record && $relation && ($relation instanceof RelationList || $relation instanceof UnsavedRelationList)) { + if($fieldname && $record && $relation && + ($relation instanceof RelationList || $relation instanceof UnsavedRelationList)) { $idList = array(); if($this->value) foreach($this->value as $id => $bool) { if($bool) { diff --git a/forms/ConfirmedPasswordField.php b/forms/ConfirmedPasswordField.php index 3f683e5bb..25498fe4b 100644 --- a/forms/ConfirmedPasswordField.php +++ b/forms/ConfirmedPasswordField.php @@ -66,7 +66,7 @@ class ConfirmedPasswordField extends FormField { * * @var FieldList */ - public $children; + public $children; /** * @param string $name diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index c0b0cc34a..e5fdff072 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -360,7 +360,8 @@ class HtmlEditorField_Toolbar extends RequestHandler { '

' . sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.ADDURL', 'Add URL')) . '

'), $remoteURL = new TextField('RemoteURL', 'http://'), new LiteralField('addURLImage', - '') + '') ); $remoteURL->addExtraClass('remoteurl'); @@ -640,7 +641,8 @@ class HtmlEditorField_Toolbar extends RequestHandler { */ protected function getFieldsForImage($url, $file) { if($file->File instanceof Image) { - $formattedImage = $file->File->generateFormattedImage('SetWidth', Config::inst()->get('Image', 'asset_preview_width')); + $formattedImage = $file->File->generateFormattedImage('SetWidth', + Config::inst()->get('Image', 'asset_preview_width')); $thumbnailURL = $formattedImage ? $formattedImage->URL : $url; } else { $thumbnailURL = $url; diff --git a/forms/ListboxField.php b/forms/ListboxField.php index 783841d80..9c672e045 100644 --- a/forms/ListboxField.php +++ b/forms/ListboxField.php @@ -179,7 +179,8 @@ class ListboxField extends DropdownField { if($this->multiple) { $fieldname = $this->name; $relation = ($fieldname && $record && $record->hasMethod($fieldname)) ? $record->$fieldname() : null; - if($fieldname && $record && $relation && ($relation instanceof RelationList || $relation instanceof UnsavedRelationList)) { + if($fieldname && $record && $relation && + ($relation instanceof RelationList || $relation instanceof UnsavedRelationList)) { $idList = (is_array($this->value)) ? array_values($this->value) : array(); if(!$record->ID) { $record->write(); // record needs to have an ID in order to set relationships diff --git a/i18n/i18n.php b/i18n/i18n.php index fd87f58fa..ae6de7c37 100644 --- a/i18n/i18n.php +++ b/i18n/i18n.php @@ -676,7 +676,8 @@ class i18n extends Object implements TemplateGlobalProvider { ), 'be' => array( 'name' => 'Belarusian', - 'native' => 'Беларуская мова' + 'native' => + 'Беларуская мова' ), 'bn' => array( 'name' => 'Bengali', @@ -1024,7 +1025,8 @@ class i18n extends Object implements TemplateGlobalProvider { ), 'be_BY' => array( 'name' => 'Belarusian', - 'native' => 'Беларуская мова' + 'native' => + 'Беларуская мова' ), 'bn_BD' => array( 'name' => 'Bengali', diff --git a/model/Database.php b/model/Database.php index e8a083ffe..020564069 100644 --- a/model/Database.php +++ b/model/Database.php @@ -1157,7 +1157,7 @@ abstract class SS_Query implements Iterator { $result .= ""; foreach($record as $k => $v) { $result .= "" . Convert::raw2xml($k) . " "; - } + } $result .= " \n"; } @@ -1234,7 +1234,7 @@ abstract class SS_Query implements Iterator { */ public function valid() { if(!$this->queryHasBegun) $this->next(); - return $this->currentRecord !== false; + return $this->currentRecord !== false; } /** diff --git a/model/Hierarchy.php b/model/Hierarchy.php index d4f6c667c..4228c0a3f 100644 --- a/model/Hierarchy.php +++ b/model/Hierarchy.php @@ -98,13 +98,15 @@ class Hierarchy extends DataExtension { * should not change this. * @param int $nodeCountThreshold See {@link self::$node_threshold_total} * @param callable $nodeCountCallback Called with the node count, which gives the callback an opportunity - * to intercept the query. Useful e.g. to avoid excessive children listings (Arguments: $parent, $numChildren) + * to intercept the query. Useful e.g. to avoid excessive children listings + * (Arguments: $parent, $numChildren) * * @return string */ public function getChildrenAsUL($attributes = "", $titleEval = '"
  • " . $child->Title', $extraArg = null, $limitToMarked = false, $childrenMethod = "AllChildrenIncludingDeleted", - $numChildrenMethod = "numChildren", $rootCall = true, $nodeCountThreshold = null, $nodeCountCallback = null) { + $numChildrenMethod = "numChildren", $rootCall = true, + $nodeCountThreshold = null, $nodeCountCallback = null) { if(!is_numeric($nodeCountThreshold)) { $nodeCountThreshold = Config::inst()->get('Hierarchy', 'node_threshold_total'); @@ -154,8 +156,8 @@ class Hierarchy extends DataExtension { $output .= $nodeCountWarning; $child->markClosed(); } else { - $output .= $child->getChildrenAsUL("", $titleEval, $extraArg, $limitToMarked, $childrenMethod, - $numChildrenMethod, false, $nodeCountThreshold); + $output .= $child->getChildrenAsUL("", $titleEval, $extraArg, $limitToMarked, + $childrenMethod, $numChildrenMethod, false, $nodeCountThreshold); } } elseif($child->isTreeOpened()) { // Since we're not loading children, don't mark it as open either diff --git a/parsers/ShortcodeParser.php b/parsers/ShortcodeParser.php index 5a1b461d3..8388873e7 100644 --- a/parsers/ShortcodeParser.php +++ b/parsers/ShortcodeParser.php @@ -245,12 +245,14 @@ class ShortcodeParser { if ($i == 0) { $err = 'Close tag "'.$tags[$i]['close'].'" is the first found tag, so has no related open tag'; - } + } else if (!$tags[$i-1]['open']) { - $err = 'Close tag "'.$tags[$i]['close'].'" preceded by another close tag "'.$tags[$i-1]['close'].'"'; + $err = 'Close tag "'.$tags[$i]['close'].'" preceded by another close tag "'. + $tags[$i-1]['close'].'"'; } else if ($tags[$i]['close'] != $tags[$i-1]['open']) { - $err = 'Close tag "'.$tags[$i]['close'].'" doesn\'t match preceding open tag "'.$tags[$i-1]['open'].'"'; + $err = 'Close tag "'.$tags[$i]['close'].'" doesn\'t match preceding open tag "'. + $tags[$i-1]['open'].'"'; } if($err) { @@ -332,7 +334,8 @@ class ShortcodeParser { $tags = $this->extractTags($node->nodeValue); if($tags) { - $node->nodeValue = $this->replaceTagsWithText($node->nodeValue, $tags, function($idx, $tag) use ($parser){ + $node->nodeValue = $this->replaceTagsWithText($node->nodeValue, $tags, + function($idx, $tag) use ($parser){ $content = $parser->callShortcode($tag['open'], $tag['attrs'], $tag['content']); if ($content === false) { @@ -381,7 +384,8 @@ class ShortcodeParser { do { $parent = $parent->parentNode; } - while($parent instanceof DOMElement && !in_array(strtolower($parent->tagName), self::$block_level_elements)); + while($parent instanceof DOMElement && + !in_array(strtolower($parent->tagName), self::$block_level_elements)); $node->setAttribute('data-parentid', count($parents)); $parents[] = $parent; @@ -451,7 +455,8 @@ class ShortcodeParser { else if($location == self::INLINE) { if(in_array(strtolower($node->tagName), self::$block_level_elements)) { user_error( - 'Requested to insert block tag '.$node->tagName.' inline - probably this will break HTML compliance', + 'Requested to insert block tag '.$node->tagName. + ' inline - probably this will break HTML compliance', E_USER_WARNING ); } @@ -461,7 +466,7 @@ class ShortcodeParser { user_error('Unknown value for $location argument '.$location, E_USER_ERROR); } } - + /** * Given a node with represents a shortcode marker and some information about the shortcode, call the * shortcode handler & replace the marker with the actual content @@ -484,7 +489,7 @@ class ShortcodeParser { $content = $tag['text']; } else { - // self::$error_behavior == self::STRIP - NOP + // self::$error_behavior == self::STRIP - NOP } } @@ -549,7 +554,8 @@ class ShortcodeParser { if(!$parent) { if($location !== self::INLINE) { - user_error("Parent block for shortcode couldn't be found, but location wasn't INLINE", E_USER_ERROR); + user_error("Parent block for shortcode couldn't be found, but location wasn't INLINE", + E_USER_ERROR); } } else { diff --git a/security/Group.php b/security/Group.php index 77faceaf9..ff0597b8a 100755 --- a/security/Group.php +++ b/security/Group.php @@ -113,11 +113,13 @@ class Group extends DataObject { } elseif($record && $record->ID) { // TODO Mark disabled once chosen.js supports it // $groupsField->setDisabledItems(array($group->ID)); - $form->Fields()->replaceField('DirectGroups', $groupsField->performReadonlyTransformation()); + $form->Fields()->replaceField('DirectGroups', + $groupsField->performReadonlyTransformation()); } } }); - $memberList = GridField::create('Members',false, $this->DirectMembers(), $config)->addExtraClass('members_grid'); + $memberList = GridField::create('Members',false, $this->DirectMembers(), $config) + ->addExtraClass('members_grid'); // @todo Implement permission checking on GridField //$memberList->setPermissions(array('edit', 'delete', 'export', 'add', 'inlineadd')); $fields->addFieldToTab('Root.Members', $memberList); diff --git a/security/Security.php b/security/Security.php index d992e4583..af760bc51 100644 --- a/security/Security.php +++ b/security/Security.php @@ -689,7 +689,7 @@ class Security extends Controller { * @return Form Returns the lost password form */ public function ChangePasswordForm() { - return Object::create('ChangePasswordForm', $this, 'ChangePasswordForm'); + return Object::create('ChangePasswordForm', $this, 'ChangePasswordForm'); } /** diff --git a/tests/behat/features/bootstrap/FeatureContext.php b/tests/behat/features/bootstrap/FeatureContext.php index a9c4835d4..557fcb8f1 100644 --- a/tests/behat/features/bootstrap/FeatureContext.php +++ b/tests/behat/features/bootstrap/FeatureContext.php @@ -31,7 +31,7 @@ class FeatureContext extends SilverStripeContext * Initializes context. * Every scenario gets it's own context object. * - * @param array $parameters context parameters (set them up through behat.yml) + * @param array $parameters context parameters (set them up through behat.yml) */ public function __construct(array $parameters) { @@ -47,22 +47,22 @@ class FeatureContext extends SilverStripeContext $this->useContext('FixtureContext', $fixtureContext); // Use blueprints to set user name from identifier - $factory = $fixtureContext->getFixtureFactory(); - $blueprint = \Injector::inst()->create('FixtureBlueprint', 'Member'); - $blueprint->addCallback('beforeCreate', function($identifier, &$data, &$fixtures) { - if(!isset($data['FirstName'])) $data['FirstName'] = $identifier; - }); - $factory->define('Member', $blueprint); + $factory = $fixtureContext->getFixtureFactory(); + $blueprint = \Injector::inst()->create('FixtureBlueprint', 'Member'); + $blueprint->addCallback('beforeCreate', function($identifier, &$data, &$fixtures) { + if(!isset($data['FirstName'])) $data['FirstName'] = $identifier; + }); + $factory->define('Member', $blueprint); } public function setMinkParameters(array $parameters) - { - parent::setMinkParameters($parameters); - - if(isset($parameters['files_path'])) { - $this->getSubcontext('FixtureContext')->setFilesPath($parameters['files_path']); - } - } + { + parent::setMinkParameters($parameters); + + if(isset($parameters['files_path'])) { + $this->getSubcontext('FixtureContext')->setFilesPath($parameters['files_path']); + } + } /** * @return FixtureFactory diff --git a/tests/control/HTTPTest.php b/tests/control/HTTPTest.php index 10b29940a..2d6a08e34 100644 --- a/tests/control/HTTPTest.php +++ b/tests/control/HTTPTest.php @@ -130,7 +130,8 @@ class HTTPTest extends SapphireTest { // background-image // Note that using /./ in urls is absolutely acceptable $test->assertEquals( - '
    Content
    ', + '
    '. + 'Content
    ', HTTP::absoluteURLs('
    Content
    ') ); @@ -169,7 +170,8 @@ class HTTPTest extends SapphireTest { // background // Note that using /./ in urls is absolutely acceptable $test->assertEquals( - '
    SS Blog
    ', + '
    '. + 'SS Blog
    ', HTTP::absoluteURLs('
    SS Blog
    ') ); @@ -210,8 +212,10 @@ class HTTPTest extends SapphireTest { // data uri $test->assertEquals( - 'Red dot', - HTTP::absoluteURLs('Red dot'), + 'Red dot', + HTTP::absoluteURLs('Red dot'), 'Data URI links are not rewritten' ); diff --git a/tests/core/CoreTest.php b/tests/core/CoreTest.php index 5603204e1..05e4312b1 100644 --- a/tests/core/CoreTest.php +++ b/tests/core/CoreTest.php @@ -24,15 +24,17 @@ class CoreTest extends SapphireTest { $user = getTempFolderUsername(); // A typical Windows location for where sites are stored on IIS - $this->assertEquals(sys_get_temp_dir() . '/silverstripe-cacheC--inetpub-wwwroot-silverstripe-test-project/' . $user, + $this->assertEquals(sys_get_temp_dir() . + '/silverstripe-cacheC--inetpub-wwwroot-silverstripe-test-project/' . $user, getTempFolder('C:\\inetpub\\wwwroot\\silverstripe-test-project')); // A typical Mac OS X location for where sites are stored - $this->assertEquals(sys_get_temp_dir() . '/silverstripe-cache-Users-joebloggs-Sites-silverstripe-test-project/' . $user, + $this->assertEquals(sys_get_temp_dir() . + '/silverstripe-cache-Users-joebloggs-Sites-silverstripe-test-project/' . $user, getTempFolder('/Users/joebloggs/Sites/silverstripe-test-project')); // A typical Linux location for where sites are stored - $this->assertEquals(sys_get_temp_dir() . '/silverstripe-cache-var-www-silverstripe-test-project/' . $user, + $this->assertEquals(sys_get_temp_dir() .'/silverstripe-cache-var-www-silverstripe-test-project/' . $user, getTempFolder('/var/www/silverstripe-test-project')); } } diff --git a/tests/core/manifest/ConfigStaticManifestTest.php b/tests/core/manifest/ConfigStaticManifestTest.php index 87d1103db..5ee09660e 100644 --- a/tests/core/manifest/ConfigStaticManifestTest.php +++ b/tests/core/manifest/ConfigStaticManifestTest.php @@ -28,6 +28,7 @@ DOC; nowdoc DOC; + // @codingStandardsIgnoreStart // Assigning multiple values static $onone, $onull = null, $oint = 1, $ofloat = 2.5, $ostring = 'string', $oarray = array(1, 2, array(3, 4), 5), $oheredoc = << "{$this->base}/module/subfolder/templates/Subfolder.ss" ), 'customthemepage' => array ( - 'Layout' => "{$this->base}/module/templates/Layout/CustomThemePage.ss", - 'themes' => - array( - 'theme' => array('main' => "{$this->base}/themes/theme/templates/CustomThemePage.ss",) - ) + 'Layout' => "{$this->base}/module/templates/Layout/CustomThemePage.ss", + 'themes' => + array( + 'theme' => array('main' => "{$this->base}/themes/theme/templates/CustomThemePage.ss",) + ) ), 'include' => array('themes' => array( 'theme' => array( diff --git a/tests/forms/RequirementsTest.php b/tests/forms/RequirementsTest.php index 6239c3ae5..75d3e8018 100644 --- a/tests/forms/RequirementsTest.php +++ b/tests/forms/RequirementsTest.php @@ -256,12 +256,14 @@ class RequirementsTest extends SapphireTest { $html = $backend->includeInHTML(false, self::$html_template); /* Javascript has correct path */ - $this->assertTrue((bool)preg_match('/src=".*\/RequirementsTest_a\.js\?m=\d\d+&test=1&test=2&test=3/', $html), + $this->assertTrue( + (bool)preg_match('/src=".*\/RequirementsTest_a\.js\?m=\d\d+&test=1&test=2&test=3/',$html), 'javascript has correct path'); /* CSS has correct path */ - $this->assertTrue((bool)preg_match('/href=".*\/RequirementsTest_a\.css\?m=\d\d+&test=1&test=2&test=3/',$html), - 'css has correct path'); + $this->assertTrue( + (bool)preg_match('/href=".*\/RequirementsTest_a\.css\?m=\d\d+&test=1&test=2&test=3/',$html), + 'css has correct path'); } public function testRequirementsBackend() { diff --git a/tests/model/HTMLTextTest.php b/tests/model/HTMLTextTest.php index c2b11a0d4..c182f652c 100644 --- a/tests/model/HTMLTextTest.php +++ b/tests/model/HTMLTextTest.php @@ -103,7 +103,8 @@ class HTMLTextTest extends SapphireTest { '

    should ignore

    First Mr. sentence. Second sentence.

    ' => 'First Mr. sentence.', "

    should ignore

    Sentence with {$many}words. Second sentence.

    " => "Sentence with {$many}words.", - '

    This classic picture book features a repetitive format that lends itself to audience interaction.  Illustrator Eric Carle submitted new, bolder artwork for the 25th anniversary edition.

    ' + '

    This classic picture book features a repetitive format that lends itself to audience interaction.'. + '  Illustrator Eric Carle submitted new, bolder artwork for the 25th anniversary edition.

    ' => 'This classic picture book features a repetitive format that lends itself to audience interaction.' ); diff --git a/tests/model/ImageTest.php b/tests/model/ImageTest.php index dfaa95eb1..d29cd1984 100644 --- a/tests/model/ImageTest.php +++ b/tests/model/ImageTest.php @@ -106,7 +106,7 @@ class ImageTest extends SapphireTest { * of the output image do not resample the file. */ public function testReluctanceToResampling() { - + $image = $this->objFromFixture('Image', 'imageWithoutTitle'); $this->assertTrue($image->isSize(300, 300)); diff --git a/tests/model/ValidationExceptionTest.php b/tests/model/ValidationExceptionTest.php index 133c21509..011fc4eba 100644 --- a/tests/model/ValidationExceptionTest.php +++ b/tests/model/ValidationExceptionTest.php @@ -78,6 +78,7 @@ class ValidationExceptionTest extends SapphireTest $this->assertEquals(E_USER_WARNING, $exception->getCode()); $this->assertEquals('An error has occurred', $exception->getMessage()); $this->assertEquals(false, $exception->getResult()->valid()); - $this->assertEquals('A spork is not a knife; A knife is not a back scratcher', $exception->getResult()->message()); + $this->assertEquals('A spork is not a knife; A knife is not a back scratcher', + $exception->getResult()->message()); } -} \ No newline at end of file +} diff --git a/tests/parsers/ShortcodeParserTest.php b/tests/parsers/ShortcodeParserTest.php index 1f519fa98..a87caff85 100644 --- a/tests/parsers/ShortcodeParserTest.php +++ b/tests/parsers/ShortcodeParserTest.php @@ -145,8 +145,9 @@ class ShortcodeParserTest extends SapphireTest { $this->assertEquals( '[[Doesnt shortcode get confused by double ]] characters', - $this->parser->parse('[[Doesnt [test_shortcode]shortcode[/test_shortcode] get confused by double ]] characters' - )); + $this->parser->parse( + '[[Doesnt [test_shortcode]shortcode[/test_shortcode] get confused by double ]] characters') + ); } public function testUnquotedArguments() { diff --git a/view/SSTemplateParser.php.inc b/view/SSTemplateParser.php.inc index 7b789b2af..e90860953 100644 --- a/view/SSTemplateParser.php.inc +++ b/view/SSTemplateParser.php.inc @@ -1002,7 +1002,8 @@ class SSTemplateParser extends Parser { // non-dynamically calculated $text = preg_replace( '/href\s*\=\s*\"\#/', - 'href="\' . (Config::inst()->get(\'SSViewer\', \'rewrite_hash_links\') ? strip_tags( $_SERVER[\'REQUEST_URI\'] ) : "") . + 'href="\' . (Config::inst()->get(\'SSViewer\', \'rewrite_hash_links\') ?' . + ' strip_tags( $_SERVER[\'REQUEST_URI\'] ) : "") . \'#', $text );