diff --git a/admin/tests/LeftAndMainTest.php b/admin/tests/LeftAndMainTest.php index 23ae15fb91f..9f727eb373e 100644 --- a/admin/tests/LeftAndMainTest.php +++ b/admin/tests/LeftAndMainTest.php @@ -49,8 +49,10 @@ public function testExtraCssAndJavascript() { $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 40a1bb81d94..1b958494ea4 100644 --- a/api/XMLDataFormatter.php +++ b/api/XMLDataFormatter.php @@ -96,7 +96,6 @@ public function convertDataObjectWithoutHeader(DataObject $obj, $fields = null, $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 71d70061ae1..99c5885b1dc 100644 --- a/cache/Cache.php +++ b/cache/Cache.php @@ -257,7 +257,7 @@ public static function factory($for, $frontend='Output', $frontendOptions=null) 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 2978868fed2..138352a9df9 100755 --- a/cli-script.php +++ b/cli-script.php @@ -75,7 +75,8 @@ 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 d5fb50545a8..173d847dd49 100644 --- a/dev/CsvBulkLoader.php +++ b/dev/CsvBulkLoader.php @@ -210,7 +210,8 @@ public function findExistingObject($record) { 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 2e29b7d79c4..e13b4c518d4 100644 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -501,12 +501,24 @@ public function tearDown() { } } - 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 419d0778d9d..9f48711e20b 100644 --- a/filesystem/ImagickBackend.php +++ b/filesystem/ImagickBackend.php @@ -255,12 +255,14 @@ public function croppedResize($width, $height) { $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 7f0c6c81409..1c07a93aaad 100644 --- a/forms/CheckboxField.php +++ b/forms/CheckboxField.php @@ -56,7 +56,9 @@ public function performReadonlyTransformation() { } 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 6e694a92400..c4bed6cbecc 100644 --- a/forms/CheckboxSetField.php +++ b/forms/CheckboxSetField.php @@ -181,7 +181,8 @@ public function setValue($value, $obj = null) { 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 3f683e5bb03..25498fe4b6f 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 c0b0cc34af6..e5fdff07259 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -360,7 +360,8 @@ public function MediaForm() { '

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

'), $remoteURL = new TextField('RemoteURL', 'http://'), new LiteralField('addURLImage', - '') + '') ); $remoteURL->addExtraClass('remoteurl'); @@ -640,7 +641,8 @@ protected function getFieldsForFlash($url, $file) { */ 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 783841d80a6..9c672e045bd 100644 --- a/forms/ListboxField.php +++ b/forms/ListboxField.php @@ -179,7 +179,8 @@ public function saveInto(DataObjectInterface $record) { 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 fd87f58fa32..ae6de7c37d6 100644 --- a/i18n/i18n.php +++ b/i18n/i18n.php @@ -676,7 +676,8 @@ public static function get_time_format() { ), 'be' => array( 'name' => 'Belarusian', - 'native' => 'Беларуская мова' + 'native' => + 'Беларуская мова' ), 'bn' => array( 'name' => 'Bengali', @@ -1024,7 +1025,8 @@ public static function get_time_format() { ), 'be_BY' => array( 'name' => 'Belarusian', - 'native' => 'Беларуская мова' + 'native' => + 'Беларуская мова' ), 'bn_BD' => array( 'name' => 'Bengali', diff --git a/model/Database.php b/model/Database.php index e8a083ffe1c..02056406941 100644 --- a/model/Database.php +++ b/model/Database.php @@ -1157,7 +1157,7 @@ public function table() { $result .= ""; foreach($record as $k => $v) { $result .= "" . Convert::raw2xml($k) . " "; - } + } $result .= " \n"; } @@ -1234,7 +1234,7 @@ public function next() { */ 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 d4f6c667c83..4228c0a3fac 100644 --- a/model/Hierarchy.php +++ b/model/Hierarchy.php @@ -98,13 +98,15 @@ public function validate(ValidationResult $validationResult) { * 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 @@ public function getChildrenAsUL($attributes = "", $titleEval = '"
  • " . $child- $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 5a1b461d301..8388873e78e 100644 --- a/parsers/ShortcodeParser.php +++ b/parsers/ShortcodeParser.php @@ -245,12 +245,14 @@ protected function extractTags($content) { 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 @@ protected function replaceAttributeTagsWithContent($htmlvalue) { $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 @@ protected function findParentsForMarkers($nodes) { 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 @@ protected function moveMarkerToCompliantHome($node, $parent, $location) { 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 @@ protected function moveMarkerToCompliantHome($node, $parent, $location) { 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 @@ protected function replaceMarkerWithContent($node, $tag) { $content = $tag['text']; } else { - // self::$error_behavior == self::STRIP - NOP + // self::$error_behavior == self::STRIP - NOP } } @@ -549,7 +554,8 @@ public function parse($content) { 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 77faceaf958..ff0597b8a9b 100755 --- a/security/Group.php +++ b/security/Group.php @@ -113,11 +113,13 @@ public function getCMSFields() { } 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 d992e45833b..af760bc5190 100644 --- a/security/Security.php +++ b/security/Security.php @@ -689,7 +689,7 @@ public function changepassword() { * @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 a9c4835d41b..557fcb8f13b 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 @@ public function __construct(array $parameters) $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 10b29940a9b..2d6a08e343d 100644 --- a/tests/control/HTTPTest.php +++ b/tests/control/HTTPTest.php @@ -130,7 +130,8 @@ public function testAbsoluteURLsCSS() { // background-image // Note that using /./ in urls is absolutely acceptable $test->assertEquals( - '
    Content
    ', + '
    '. + 'Content
    ', HTTP::absoluteURLs('
    Content
    ') ); @@ -169,7 +170,8 @@ public function testAbsoluteURLsAttributes() { // background // Note that using /./ in urls is absolutely acceptable $test->assertEquals( - '
    SS Blog
    ', + '
    '. + 'SS Blog
    ', HTTP::absoluteURLs('
    SS Blog
    ') ); @@ -210,8 +212,10 @@ public function testURISchemes() { // 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 5603204e10d..05e4312b1f0 100644 --- a/tests/core/CoreTest.php +++ b/tests/core/CoreTest.php @@ -24,15 +24,17 @@ public function testGetTempPathInProject() { $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 87d1103dbb8..5ee09660eed 100644 --- a/tests/core/manifest/ConfigStaticManifestTest.php +++ b/tests/core/manifest/ConfigStaticManifestTest.php @@ -28,6 +28,7 @@ class ConfigStaticManifestTest extends SapphireTest { 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 6239c3ae508..75d3e801885 100644 --- a/tests/forms/RequirementsTest.php +++ b/tests/forms/RequirementsTest.php @@ -256,12 +256,14 @@ public function testArgsInUrls() { $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 c2b11a0d4f4..c182f652ce1 100644 --- a/tests/model/HTMLTextTest.php +++ b/tests/model/HTMLTextTest.php @@ -103,7 +103,8 @@ public function testFirstSentence() { '

    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 dfaa95eb137..d29cd198429 100644 --- a/tests/model/ImageTest.php +++ b/tests/model/ImageTest.php @@ -106,7 +106,7 @@ public function testMultipleGenerateManipulationCalls() { * 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 133c21509e4..011fc4ebad3 100644 --- a/tests/model/ValidationExceptionTest.php +++ b/tests/model/ValidationExceptionTest.php @@ -78,6 +78,7 @@ public function testCreateWithComplexValidationResultAndMessage() { $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 1f519fa98ee..a87caff8574 100644 --- a/tests/parsers/ShortcodeParserTest.php +++ b/tests/parsers/ShortcodeParserTest.php @@ -145,8 +145,9 @@ public function testShortcodeEscaping() { $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 7b789b2af2b..e9086095346 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 );