Fixing string concat CS issues

This commit is contained in:
Daniel Hensby 2018-01-16 18:39:30 +00:00
parent ff05a7265e
commit db610aaf3b
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
126 changed files with 397 additions and 513 deletions

View File

@ -157,8 +157,7 @@ class RSSFeed extends ViewableData
{ {
$title = Convert::raw2xml($title); $title = Convert::raw2xml($title);
Requirements::insertHeadTags( Requirements::insertHeadTags(
'<link rel="alternate" type="application/rss+xml" title="' . $title . '<link rel="alternate" type="application/rss+xml" title="' . $title . '" href="' . $url . '" />'
'" href="' . $url . '" />'
); );
} }

View File

@ -130,9 +130,7 @@ class RSSFeed_Entry extends ViewableData
} }
throw new BadMethodCallException( throw new BadMethodCallException(
get_class($this->failover) . get_class($this->failover) . " object has neither an AbsoluteLink nor a Link method." . " Can't put a link in the RSS feed",
" object has neither an AbsoluteLink nor a Link method." .
" Can't put a link in the RSS feed",
E_USER_WARNING E_USER_WARNING
); );
} }

View File

@ -266,8 +266,7 @@ class RequestHandler extends ViewableData
$class = static::class; $class = static::class;
$latestParams = var_export($request->latestParams(), true); $latestParams = var_export($request->latestParams(), true);
Debug::message( Debug::message(
"Rule '{$rule}' matched to action '{$action}' on {$class}. ". "Rule '{$rule}' matched to action '{$action}' on {$class}. " . "Latest request params: {$latestParams}"
"Latest request params: {$latestParams}"
); );
} }
@ -566,8 +565,7 @@ class RequestHandler extends ViewableData
// no link defined by default // no link defined by default
trigger_error( trigger_error(
'Request handler '.static::class. ' does not have a url_segment defined. '. 'Request handler ' . static::class . ' does not have a url_segment defined. ' . 'Relying on this link may be an application error',
'Relying on this link may be an application error',
E_USER_WARNING E_USER_WARNING
); );
return null; return null;

View File

@ -76,9 +76,7 @@ class TempFolder
} }
// failing the above, try finding a namespaced silverstripe-cache dir in the system temp // failing the above, try finding a namespaced silverstripe-cache dir in the system temp
$tempPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $tempPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION) . str_replace(array(' ', '/', ':', '\\'), '-', $base);
'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION) .
str_replace(array(' ', '/', ':', '\\'), '-', $base);
if (!@file_exists($tempPath)) { if (!@file_exists($tempPath)) {
$oldUMask = umask(0); $oldUMask = umask(0);
@mkdir($tempPath, 0777); @mkdir($tempPath, 0777);
@ -107,9 +105,7 @@ class TempFolder
if (!$worked) { if (!$worked) {
throw new Exception( throw new Exception(
'Permission problem gaining access to a temp folder. ' . 'Permission problem gaining access to a temp folder. ' . 'Please create a folder named silverstripe-cache in the base folder ' . 'of the installation and ensure it has the correct permissions'
'Please create a folder named silverstripe-cache in the base folder ' .
'of the installation and ensure it has the correct permissions'
); );
} }

View File

@ -247,8 +247,7 @@ class MySQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
preg_quote('"%".*'), preg_quote('"%".*'),
preg_quote('*.*') preg_quote('*.*')
); );
$expression = '/GRANT[ ,\w]+((ALL PRIVILEGES)|('.$permission.'(?! ((VIEW)|(ROUTINE)))))[ ,\w]+ON '. $expression = '/GRANT[ ,\w]+((ALL PRIVILEGES)|(' . $permission . '(?! ((VIEW)|(ROUTINE)))))[ ,\w]+ON ' . $dbPattern . '/i';
$dbPattern.'/i';
return preg_match($expression, $grant); return preg_match($expression, $grant);
} }

View File

@ -144,8 +144,7 @@ class FormRequestHandler extends RequestHandler
if (empty($vars[$securityID])) { if (empty($vars[$securityID])) {
$this->httpError(400, _t( $this->httpError(400, _t(
"SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE", "SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE",
"There seems to have been a technical problem. Please click the back button, ". "There seems to have been a technical problem. Please click the back button, " . "refresh your browser, and try again."
"refresh your browser, and try again."
)); ));
} else { } else {
// Clear invalid token on refresh // Clear invalid token on refresh
@ -258,8 +257,7 @@ class FormRequestHandler extends RequestHandler
$legacyActions = $this->form->config()->get('allowed_actions'); $legacyActions = $this->form->config()->get('allowed_actions');
if ($legacyActions) { if ($legacyActions) {
throw new BadMethodCallException( throw new BadMethodCallException(
"allowed_actions are not valid on Form class " . get_class($this->form) . "allowed_actions are not valid on Form class " . get_class($this->form) . ". Implement these in subclasses of " . static::class . " instead"
". Implement these in subclasses of " . static::class . " instead"
); );
} }

View File

@ -897,8 +897,7 @@ class GridField extends FormField
if (!$token->checkRequest($request)) { if (!$token->checkRequest($request)) {
$this->httpError(400, _t( $this->httpError(400, _t(
"SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE", "SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE",
"There seems to have been a technical problem. Please click the back button, ". "There seems to have been a technical problem. Please click the back button, " . "refresh your browser, and try again."
"refresh your browser, and try again."
)); ));
} }

View File

@ -51,8 +51,7 @@ class GridFieldPageCount implements GridField_HTMLProvider
if (!$paginator && GridFieldPageCount::config()->uninherited('require_paginator')) { if (!$paginator && GridFieldPageCount::config()->uninherited('require_paginator')) {
throw new LogicException( throw new LogicException(
static::class . " relies on a GridFieldPaginator to be added " . static::class . " relies on a GridFieldPaginator to be added " . "to the same GridField, but none are present."
"to the same GridField, but none are present."
); );
} }

View File

@ -168,8 +168,7 @@ SCRIPT;
// Join list of paths // Join list of paths
$filesList = Convert::raw2js(implode(',', $fileURLS)); $filesList = Convert::raw2js(implode(',', $fileURLS));
// Mark all themes, plugins and languages as done // Mark all themes, plugins and languages as done
$buffer[] = "window.tinymce.each('$filesList'.split(',')," . $buffer[] = "window.tinymce.each('$filesList'.split(',')," . "function(f){tinymce.ScriptLoader.markDone(baseURL+f);});";
"function(f){tinymce.ScriptLoader.markDone(baseURL+f);});";
$buffer[] = '})();'; $buffer[] = '})();';
return implode("\n", $buffer) . "\n"; return implode("\n", $buffer) . "\n";

View File

@ -198,8 +198,7 @@ PHP
$controller = $controller->customise(array( $controller = $controller->customise(array(
'Content' => DBField::create_field(DBHTMLText::class, _t( 'Content' => DBField::create_field(DBHTMLText::class, _t(
__CLASS__ . '.SUCCESSCONTENT', __CLASS__ . '.SUCCESSCONTENT',
'<p>Login success. If you are not automatically redirected ' . '<p>Login success. If you are not automatically redirected ' . '<a target="_top" href="{link}">click here</a></p>',
'<a target="_top" href="{link}">click here</a></p>',
'Login message displayed in the cms popup once a user has re-authenticated themselves', 'Login message displayed in the cms popup once a user has re-authenticated themselves',
array('link' => Convert::raw2att($backURL)) array('link' => Convert::raw2att($backURL))
)) ))

View File

@ -306,8 +306,7 @@ class InheritedPermissions implements PermissionChecker
$baseTable = DataObject::getSchema()->baseDataTable($this->getBaseClass()); $baseTable = DataObject::getSchema()->baseDataTable($this->getBaseClass());
$uninheritedPermissions = $stageRecords $uninheritedPermissions = $stageRecords
->where([ ->where([
"(\"$typeField\" IN (?, ?) OR " . "(\"$typeField\" IN (?, ?) OR " . "(\"$typeField\" = ? AND \"$groupJoinTable\".\"{$baseTable}ID\" IS NOT NULL))"
"(\"$typeField\" = ? AND \"$groupJoinTable\".\"{$baseTable}ID\" IS NOT NULL))"
=> [ => [
self::ANYONE, self::ANYONE,
self::LOGGED_IN_USERS, self::LOGGED_IN_USERS,
@ -316,8 +315,7 @@ class InheritedPermissions implements PermissionChecker
]) ])
->leftJoin( ->leftJoin(
$groupJoinTable, $groupJoinTable,
"\"$groupJoinTable\".\"{$baseTable}ID\" = \"{$baseTable}\".\"ID\" AND " . "\"$groupJoinTable\".\"{$baseTable}ID\" = \"{$baseTable}\".\"ID\" AND " . "\"$groupJoinTable\".\"GroupID\" IN ($groupIDsSQLList)"
"\"$groupJoinTable\".\"GroupID\" IN ($groupIDsSQLList)"
)->column('ID'); )->column('ID');
} else { } else {
// Only view pages with ViewType = Anyone if not logged in // Only view pages with ViewType = Anyone if not logged in

View File

@ -351,8 +351,7 @@ class Member extends DataObject
$result->addError( $result->addError(
_t( _t(
__CLASS__ . '.ERRORLOCKEDOUT2', __CLASS__ . '.ERRORLOCKEDOUT2',
'Your account has been temporarily disabled because of too many failed attempts at ' . 'Your account has been temporarily disabled because of too many failed attempts at ' . 'logging in. Please try again in {count} minutes.',
'logging in. Please try again in {count} minutes.',
null, null,
array('count' => static::config()->get('lock_out_delay_mins')) array('count' => static::config()->get('lock_out_delay_mins'))
) )

View File

@ -22,8 +22,7 @@ class HTML4Value extends HTMLValue
$errorState = libxml_use_internal_errors(true); $errorState = libxml_use_internal_errors(true);
$result = $this->getDocument()->loadHTML( $result = $this->getDocument()->loadHTML(
'<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head>' . '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head>' . "<body>$content</body></html>"
"<body>$content</body></html>"
); );
libxml_clear_errors(); libxml_clear_errors();
libxml_use_internal_errors($errorState); libxml_use_internal_errors($errorState);

View File

@ -374,11 +374,9 @@ class ShortcodeParser
if ($i == 0) { if ($i == 0) {
$err = 'Close tag "' . $tags[$i]['close'] . '" is the first found tag, so has no related open tag'; $err = 'Close tag "' . $tags[$i]['close'] . '" is the first found tag, so has no related open tag';
} elseif (!$tags[$i-1]['open']) { } elseif (!$tags[$i-1]['open']) {
$err = 'Close tag "'.$tags[$i]['close'].'" preceded by another close tag "'. $err = 'Close tag "' . $tags[$i]['close'] . '" preceded by another close tag "' . $tags[$i-1]['close'] . '"';
$tags[$i-1]['close'].'"';
} elseif ($tags[$i]['close'] != $tags[$i-1]['open']) { } elseif ($tags[$i]['close'] != $tags[$i-1]['open']) {
$err = 'Close tag "'.$tags[$i]['close'].'" doesn\'t match preceding open tag "'. $err = 'Close tag "' . $tags[$i]['close'] . '" doesn\'t match preceding open tag "' . $tags[$i-1]['open'] . '"';
$tags[$i-1]['open'].'"';
} }
if ($err) { if ($err) {
@ -599,8 +597,7 @@ class ShortcodeParser
elseif ($location == self::INLINE) { elseif ($location == self::INLINE) {
if (in_array(strtolower($node->tagName), self::$block_level_elements)) { if (in_array(strtolower($node->tagName), self::$block_level_elements)) {
user_error( user_error(
'Requested to insert block tag '.$node->tagName. 'Requested to insert block tag ' . $node->tagName . ' inline - probably this will break HTML compliance',
' inline - probably this will break HTML compliance',
E_USER_WARNING E_USER_WARNING
); );
} }

View File

@ -44,9 +44,7 @@ class ViewableData_Debugger extends ViewableData
// debugging info for a specific field // debugging info for a specific field
$class = get_class($this->object); $class = get_class($this->object);
if ($field) { if ($field) {
return "<b>Debugging Information for {$class}->{$field}</b><br/>" . return "<b>Debugging Information for {$class}->{$field}</b><br/>" . ($this->object->hasMethod($field) ? "Has method '$field'<br/>" : null) . ($this->object->hasField($field) ? "Has field '$field'<br/>" : null);
($this->object->hasMethod($field) ? "Has method '$field'<br/>" : null) .
($this->object->hasField($field) ? "Has field '$field'<br/>" : null);
} }
// debugging information for the entire class // debugging information for the entire class

View File

@ -1,9 +1,7 @@
<?php <?php
if (!defined('BASE_PATH')) { if (!defined('BASE_PATH')) {
echo "BASE_PATH hasn't been defined. This probably means that framework/Core/Constants.php hasn't been " . echo "BASE_PATH hasn't been defined. This probably means that framework/Core/Constants.php hasn't been " . "included by Composer's autoloader.\n" . "Make sure the you are running your tests via vendor/bin/phpunit and your autoloader is up to date.\n";
"included by Composer's autoloader.\n" .
"Make sure the you are running your tests via vendor/bin/phpunit and your autoloader is up to date.\n";
exit(1); exit(1);
} }

View File

@ -108,40 +108,35 @@ class ControllerTest extends FunctionalTest
$this->assertEquals( $this->assertEquals(
200, 200,
$response->getStatusCode(), $response->getStatusCode(),
'Access granted on index action without $allowed_actions on defining controller, ' . 'Access granted on index action without $allowed_actions on defining controller, ' . 'when called without an action in the URL'
'when called without an action in the URL'
); );
$response = $this->get("UnsecuredController/index"); $response = $this->get("UnsecuredController/index");
$this->assertEquals( $this->assertEquals(
200, 200,
$response->getStatusCode(), $response->getStatusCode(),
'Access denied on index action without $allowed_actions on defining controller, ' . 'Access denied on index action without $allowed_actions on defining controller, ' . 'when called with an action in the URL'
'when called with an action in the URL'
); );
$response = $this->get("UnsecuredController/method1"); $response = $this->get("UnsecuredController/method1");
$this->assertEquals( $this->assertEquals(
403, 403,
$response->getStatusCode(), $response->getStatusCode(),
'Access denied on action without $allowed_actions on defining controller, ' . 'Access denied on action without $allowed_actions on defining controller, ' . 'when called without an action in the URL'
'when called without an action in the URL'
); );
$response = $this->get("AccessBaseController/"); $response = $this->get("AccessBaseController/");
$this->assertEquals( $this->assertEquals(
200, 200,
$response->getStatusCode(), $response->getStatusCode(),
'Access granted on index with empty $allowed_actions on defining controller, ' . 'Access granted on index with empty $allowed_actions on defining controller, ' . 'when called without an action in the URL'
'when called without an action in the URL'
); );
$response = $this->get("AccessBaseController/index"); $response = $this->get("AccessBaseController/index");
$this->assertEquals( $this->assertEquals(
200, 200,
$response->getStatusCode(), $response->getStatusCode(),
'Access granted on index with empty $allowed_actions on defining controller, ' . 'Access granted on index with empty $allowed_actions on defining controller, ' . 'when called with an action in the URL'
'when called with an action in the URL'
); );
$response = $this->get("AccessBaseController/method1"); $response = $this->get("AccessBaseController/method1");
@ -155,48 +150,42 @@ class ControllerTest extends FunctionalTest
$this->assertEquals( $this->assertEquals(
403, 403,
$response->getStatusCode(), $response->getStatusCode(),
'Access denied on action with empty $allowed_actions on defining controller, ' . 'Access denied on action with empty $allowed_actions on defining controller, ' . 'even when action is allowed in subclasses (allowed_actions don\'t inherit)'
'even when action is allowed in subclasses (allowed_actions don\'t inherit)'
); );
$response = $this->get("AccessSecuredController/"); $response = $this->get("AccessSecuredController/");
$this->assertEquals( $this->assertEquals(
200, 200,
$response->getStatusCode(), $response->getStatusCode(),
'Access granted on index with non-empty $allowed_actions on defining controller, ' . 'Access granted on index with non-empty $allowed_actions on defining controller, ' . 'even when index isn\'t specifically mentioned in there'
'even when index isn\'t specifically mentioned in there'
); );
$response = $this->get("AccessSecuredController/method1"); $response = $this->get("AccessSecuredController/method1");
$this->assertEquals( $this->assertEquals(
403, 403,
$response->getStatusCode(), $response->getStatusCode(),
'Access denied on action which is only defined in parent controller, ' . 'Access denied on action which is only defined in parent controller, ' . 'even when action is allowed in currently called class (allowed_actions don\'t inherit)'
'even when action is allowed in currently called class (allowed_actions don\'t inherit)'
); );
$response = $this->get("AccessSecuredController/method2"); $response = $this->get("AccessSecuredController/method2");
$this->assertEquals( $this->assertEquals(
200, 200,
$response->getStatusCode(), $response->getStatusCode(),
'Access granted on action originally defined with empty $allowed_actions on parent controller, ' . 'Access granted on action originally defined with empty $allowed_actions on parent controller, ' . 'because it has been redefined in the subclass'
'because it has been redefined in the subclass'
); );
$response = $this->get("AccessSecuredController/templateaction"); $response = $this->get("AccessSecuredController/templateaction");
$this->assertEquals( $this->assertEquals(
403, 403,
$response->getStatusCode(), $response->getStatusCode(),
'Access denied on action with $allowed_actions on defining controller, ' . 'Access denied on action with $allowed_actions on defining controller, ' . 'if action is not a method but rather a template discovered by naming convention'
'if action is not a method but rather a template discovered by naming convention'
); );
$response = $this->get("AccessSecuredController/templateaction"); $response = $this->get("AccessSecuredController/templateaction");
$this->assertEquals( $this->assertEquals(
403, 403,
$response->getStatusCode(), $response->getStatusCode(),
'Access denied on action with $allowed_actions on defining controller, ' . 'Access denied on action with $allowed_actions on defining controller, ' . 'if action is not a method but rather a template discovered by naming convention'
'if action is not a method but rather a template discovered by naming convention'
); );
Security::setCurrentUser($adminUser); Security::setCurrentUser($adminUser);
@ -204,8 +193,7 @@ class ControllerTest extends FunctionalTest
$this->assertEquals( $this->assertEquals(
200, 200,
$response->getStatusCode(), $response->getStatusCode(),
'Access granted for logged in admin on action with $allowed_actions on defining controller, ' . 'Access granted for logged in admin on action with $allowed_actions on defining controller, ' . 'if action is not a method but rather a template discovered by naming convention'
'if action is not a method but rather a template discovered by naming convention'
); );
Security::setCurrentUser(null); Security::setCurrentUser(null);
@ -213,16 +201,14 @@ class ControllerTest extends FunctionalTest
$this->assertEquals( $this->assertEquals(
403, 403,
$response->getStatusCode(), $response->getStatusCode(),
'Access denied on action with $allowed_actions on defining controller, ' . 'Access denied on action with $allowed_actions on defining controller, ' . 'when restricted by unmatched permission code'
'when restricted by unmatched permission code'
); );
$response = $this->get("AccessSecuredController/aDmiNOnlY"); $response = $this->get("AccessSecuredController/aDmiNOnlY");
$this->assertEquals( $this->assertEquals(
403, 403,
$response->getStatusCode(), $response->getStatusCode(),
'Access denied on action with $allowed_actions on defining controller, ' . 'Access denied on action with $allowed_actions on defining controller, ' . 'regardless of capitalization'
'regardless of capitalization'
); );
$response = $this->get('AccessSecuredController/protectedmethod'); $response = $this->get('AccessSecuredController/protectedmethod');
@ -245,40 +231,35 @@ class ControllerTest extends FunctionalTest
$this->assertEquals( $this->assertEquals(
200, 200,
$response->getStatusCode(), $response->getStatusCode(),
"Access granted to method defined in allowed_actions on extension, " . "Access granted to method defined in allowed_actions on extension, " . "where method is also defined on extension"
"where method is also defined on extension"
); );
$response = $this->get('AccessSecuredController/extensionmethod1'); $response = $this->get('AccessSecuredController/extensionmethod1');
$this->assertEquals( $this->assertEquals(
200, 200,
$response->getStatusCode(), $response->getStatusCode(),
"Access granted to method defined in allowed_actions on extension, " . "Access granted to method defined in allowed_actions on extension, " . "where method is also defined on extension, even when called in a subclass"
"where method is also defined on extension, even when called in a subclass"
); );
$response = $this->get('AccessBaseController/extensionmethod2'); $response = $this->get('AccessBaseController/extensionmethod2');
$this->assertEquals( $this->assertEquals(
404, 404,
$response->getStatusCode(), $response->getStatusCode(),
"Access denied to method not defined in allowed_actions on extension, " . "Access denied to method not defined in allowed_actions on extension, " . "where method is also defined on extension"
"where method is also defined on extension"
); );
$response = $this->get('IndexSecuredController/'); $response = $this->get('IndexSecuredController/');
$this->assertEquals( $this->assertEquals(
403, 403,
$response->getStatusCode(), $response->getStatusCode(),
"Access denied when index action is limited through allowed_actions, " . "Access denied when index action is limited through allowed_actions, " . "and doesn't satisfy checks, and action is empty"
"and doesn't satisfy checks, and action is empty"
); );
$response = $this->get('IndexSecuredController/index'); $response = $this->get('IndexSecuredController/index');
$this->assertEquals( $this->assertEquals(
403, 403,
$response->getStatusCode(), $response->getStatusCode(),
"Access denied when index action is limited through allowed_actions, " . "Access denied when index action is limited through allowed_actions, " . "and doesn't satisfy checks"
"and doesn't satisfy checks"
); );
Security::setCurrentUser($adminUser); Security::setCurrentUser($adminUser);
@ -286,8 +267,7 @@ class ControllerTest extends FunctionalTest
$this->assertEquals( $this->assertEquals(
200, 200,
$response->getStatusCode(), $response->getStatusCode(),
"Access granted when index action is limited through allowed_actions, " . "Access granted when index action is limited through allowed_actions, " . "and does satisfy checks"
"and does satisfy checks"
); );
Security::setCurrentUser(null); Security::setCurrentUser(null);
} }
@ -433,8 +413,7 @@ class ControllerTest extends FunctionalTest
$this->assertFalse( $this->assertFalse(
$securedController->hasAction('protectedextensionmethod'), $securedController->hasAction('protectedextensionmethod'),
'Method is not visible when defined on an extension, part of allowed_actions, ' . 'Method is not visible when defined on an extension, part of allowed_actions, ' . 'but with protected visibility'
'but with protected visibility'
); );
} }

View File

@ -226,8 +226,7 @@ class HTTPTest extends FunctionalTest
// background-image // background-image
// Note that using /./ in urls is absolutely acceptable // Note that using /./ in urls is absolutely acceptable
$this->assertEquals( $this->assertEquals(
'<div style="background-image: url(\'http://www.silverstripe.org/./images/mybackground.gif\');">'. '<div style="background-image: url(\'http://www.silverstripe.org/./images/mybackground.gif\');">' . 'Content</div>',
'Content</div>',
HTTP::absoluteURLs('<div style="background-image: url(\'./images/mybackground.gif\');">Content</div>') HTTP::absoluteURLs('<div style="background-image: url(\'./images/mybackground.gif\');">Content</div>')
); );
@ -290,8 +289,7 @@ class HTTPTest extends FunctionalTest
// background // background
// Note that using /./ in urls is absolutely acceptable // Note that using /./ in urls is absolutely acceptable
$this->assertEquals( $this->assertEquals(
'<div background="http://www.silverstripe.org/./themes/silverstripe/images/nav-bg-repeat-2.png">'. '<div background="http://www.silverstripe.org/./themes/silverstripe/images/nav-bg-repeat-2.png">' . 'SS Blog</div>',
'SS Blog</div>',
HTTP::absoluteURLs('<div background="./themes/silverstripe/images/nav-bg-repeat-2.png">SS Blog</div>') HTTP::absoluteURLs('<div background="./themes/silverstripe/images/nav-bg-repeat-2.png">SS Blog</div>')
); );
@ -342,11 +340,9 @@ class HTTPTest extends FunctionalTest
// data uri // data uri
$this->assertEquals( $this->assertEquals(
'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38'. '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38' . 'GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />',
'GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />',
HTTP::absoluteURLs( HTTP::absoluteURLs(
'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH'. '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH' . 'ElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />'
'ElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />'
), ),
'Data URI links are not rewritten' 'Data URI links are not rewritten'
); );

View File

@ -136,12 +136,7 @@ class ConvertTest extends SapphireTest
"Single quotes are decoded correctly" "Single quotes are decoded correctly"
); );
$val8 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor '. $val8 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor ' . 'incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud ' . 'exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute ' . 'irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla ' . 'pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia ' . 'deserunt mollit anim id est laborum.';
'incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud '.
'exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute '.
'irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla '.
'pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia '.
'deserunt mollit anim id est laborum.';
$this->assertEquals($val8, Convert::html2raw($val8), 'Test long text is unwrapped'); $this->assertEquals($val8, Convert::html2raw($val8), 'Test long text is unwrapped');
$this->assertEquals( $this->assertEquals(
<<<PHP <<<PHP

View File

@ -29,8 +29,7 @@ class CoreTest extends SapphireTest
$this->assertEquals(TempFolder::getTempFolder(BASE_PATH), $this->tempPath . DIRECTORY_SEPARATOR . $user); $this->assertEquals(TempFolder::getTempFolder(BASE_PATH), $this->tempPath . DIRECTORY_SEPARATOR . $user);
} else { } else {
$user = TempFolder::getTempFolderUsername(); $user = TempFolder::getTempFolderUsername();
$base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . $base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION);
preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION);
// A typical Windows location for where sites are stored on IIS // A typical Windows location for where sites are stored on IIS
$this->assertEquals( $this->assertEquals(
@ -56,8 +55,7 @@ class CoreTest extends SapphireTest
{ {
parent::tearDown(); parent::tearDown();
$user = TempFolder::getTempFolderUsername(); $user = TempFolder::getTempFolderUsername();
$base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . $base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION);
preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION);
foreach (array( foreach (array(
'C--inetpub-wwwroot-silverstripe-test-project', 'C--inetpub-wwwroot-silverstripe-test-project',
'-Users-joebloggs-Sites-silverstripe-test-project', '-Users-joebloggs-Sites-silverstripe-test-project',

View File

@ -109,8 +109,7 @@ class FixtureBlueprintTest extends SapphireTest
'one', 'one',
array( array(
'ManyManyRelation' => 'ManyManyRelation' =>
'=>'.DataObjectRelation::class.'.relation1,' . '=>' . DataObjectRelation::class . '.relation1,' . '=>' . DataObjectRelation::class . '.relation2'
'=>'.DataObjectRelation::class.'.relation2'
), ),
array( array(
DataObjectRelation::class => array( DataObjectRelation::class => array(

View File

@ -95,8 +95,7 @@ class GridFieldDeleteActionTest extends SapphireTest
$this->expectException(HTTPResponse_Exception::class); $this->expectException(HTTPResponse_Exception::class);
$this->expectExceptionMessage(_t( $this->expectExceptionMessage(_t(
"SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE", "SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE",
"There seems to have been a technical problem. Please click the back button, ". "There seems to have been a technical problem. Please click the back button, " . "refresh your browser, and try again."
"refresh your browser, and try again."
)); ));
$this->expectExceptionCode(400); $this->expectExceptionCode(400);
$stateID = 'testGridStateActionField'; $stateID = 'testGridStateActionField';

View File

@ -66,9 +66,7 @@ class GridFieldExportButtonTest extends SapphireTest
$button->setExportColumns(['Name' => 'My Name']); $button->setExportColumns(['Name' => 'My Name']);
$this->assertEquals( $this->assertEquals(
'"My Name"'."\n". '"My Name"' . "\n" . 'Test' . "\n" . 'Test2' . "\n",
'Test'."\n".
'Test2'."\n",
$button->generateExportFileData($this->gridField) $button->generateExportFileData($this->gridField)
); );
} }
@ -101,9 +99,7 @@ class GridFieldExportButtonTest extends SapphireTest
]); ]);
$this->assertEquals( $this->assertEquals(
'Name,City'."\n". 'Name,City' . "\n" . 'Test,"City city"' . "\n" . 'Test2,"Quoted ""City"" 2 city"' . "\n",
'Test,"City city"'."\n".
'Test2,"Quoted ""City"" 2 city"'."\n",
$button->generateExportFileData($this->gridField) $button->generateExportFileData($this->gridField)
); );
} }
@ -117,9 +113,7 @@ class GridFieldExportButtonTest extends SapphireTest
]); ]);
$this->assertEquals( $this->assertEquals(
'Name,strtolower'."\n". 'Name,strtolower' . "\n" . 'Test,City' . "\n" . 'Test2,"Quoted ""City"" 2"' . "\n",
'Test,City'."\n".
'Test2,"Quoted ""City"" 2"'."\n",
$button->generateExportFileData($this->gridField) $button->generateExportFileData($this->gridField)
); );
} }
@ -134,8 +128,7 @@ class GridFieldExportButtonTest extends SapphireTest
$button->setCsvHasHeader(false); $button->setCsvHasHeader(false);
$this->assertEquals( $this->assertEquals(
'Test,City'."\n". 'Test,City' . "\n" . 'Test2,"Quoted ""City"" 2"' . "\n",
'Test2,"Quoted ""City"" 2"'."\n",
$button->generateExportFileData($this->gridField) $button->generateExportFileData($this->gridField)
); );
} }
@ -154,23 +147,7 @@ class GridFieldExportButtonTest extends SapphireTest
$this->gridField->setList($arrayList); $this->gridField->setList($arrayList);
$this->assertEquals( $this->assertEquals(
"ID\n". "ID\n" . "1\n" . "2\n" . "3\n" . "4\n" . "5\n" . "6\n" . "7\n" . "8\n" . "9\n" . "10\n" . "11\n" . "12\n" . "13\n" . "14\n" . "15\n" . "16\n",
"1\n".
"2\n".
"3\n".
"4\n".
"5\n".
"6\n".
"7\n".
"8\n".
"9\n".
"10\n".
"11\n".
"12\n".
"13\n".
"14\n".
"15\n".
"16\n",
$button->generateExportFileData($this->gridField) $button->generateExportFileData($this->gridField)
); );
} }

View File

@ -111,8 +111,7 @@ class TreeDropdownFieldTest extends SapphireTest
$folder1Subfolder1 = $this->objFromFixture(Folder::class, 'folder1-subfolder1'); $folder1Subfolder1 = $this->objFromFixture(Folder::class, 'folder1-subfolder1');
$parser = new CSSContentParser($tree); $parser = new CSSContentParser($tree);
$cssPath = 'ul.tree li#selector-TestTree-'.$folder1->ID.' li#selector-TestTree-'. $cssPath = 'ul.tree li#selector-TestTree-' . $folder1->ID . ' li#selector-TestTree-' . $folder1Subfolder1->ID . ' a span.item';
$folder1Subfolder1->ID.' a span.item';
$firstResult = $parser->getBySelector($cssPath); $firstResult = $parser->getBySelector($cssPath);
$this->assertEquals( $this->assertEquals(
$folder1Subfolder1->Name, $folder1Subfolder1->Name,
@ -149,8 +148,7 @@ class TreeDropdownFieldTest extends SapphireTest
$parser = new CSSContentParser($tree); $parser = new CSSContentParser($tree);
// Even if we used File as the source object, folders are still returned because Folder is a File // Even if we used File as the source object, folders are still returned because Folder is a File
$cssPath = 'ul.tree li#selector-TestTree-'.$folder1->ID.' li#selector-TestTree-'. $cssPath = 'ul.tree li#selector-TestTree-' . $folder1->ID . ' li#selector-TestTree-' . $folder1Subfolder1->ID . ' a span.item';
$folder1Subfolder1->ID.' a span.item';
$firstResult = $parser->getBySelector($cssPath); $firstResult = $parser->getBySelector($cssPath);
$this->assertEquals( $this->assertEquals(
$folder1Subfolder1->Name, $folder1Subfolder1->Name,

View File

@ -28,14 +28,7 @@ class DataObjectLazyLoadingTest extends SapphireTest
$db = DB::get_conn(); $db = DB::get_conn();
$playerList = new DataList(SubTeam::class); $playerList = new DataList(SubTeam::class);
$playerList = $playerList->setQueriedColumns(array('ID')); $playerList = $playerList->setQueriedColumns(array('ID'));
$expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . '"DataObjectTest_Team"."Created", "DataObjectTest_Team"."ID", CASE WHEN ' . '"DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' . $db->quoteString(Team::class) . ' END AS "RecordClassName", "DataObjectTest_Team"."Title" ' . 'FROM "DataObjectTest_Team" ' . 'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" ' . 'WHERE ("DataObjectTest_Team"."ClassName" IN (?))' . ' ORDER BY "DataObjectTest_Team"."Title" ASC';
'"DataObjectTest_Team"."Created", "DataObjectTest_Team"."ID", CASE WHEN '.
'"DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' .
$db->quoteString(Team::class).' END AS "RecordClassName", "DataObjectTest_Team"."Title" '.
'FROM "DataObjectTest_Team" ' .
'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" ' .
'WHERE ("DataObjectTest_Team"."ClassName" IN (?))' .
' ORDER BY "DataObjectTest_Team"."Title" ASC';
$this->assertSQLEquals($expected, $playerList->sql($parameters)); $this->assertSQLEquals($expected, $playerList->sql($parameters));
} }
@ -44,14 +37,7 @@ class DataObjectLazyLoadingTest extends SapphireTest
$db = DB::get_conn(); $db = DB::get_conn();
$playerList = new DataList(SubTeam::class); $playerList = new DataList(SubTeam::class);
$playerList = $playerList->setQueriedColumns(array('Title', 'SubclassDatabaseField')); $playerList = $playerList->setQueriedColumns(array('Title', 'SubclassDatabaseField'));
$expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . '"DataObjectTest_Team"."Created", "DataObjectTest_Team"."Title", ' . '"DataObjectTest_SubTeam"."SubclassDatabaseField", "DataObjectTest_Team"."ID", CASE WHEN ' . '"DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' . $db->quoteString(Team::class) . ' END AS "RecordClassName" FROM "DataObjectTest_Team" ' . 'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" WHERE ' . '("DataObjectTest_Team"."ClassName" IN (?)) ' . 'ORDER BY "DataObjectTest_Team"."Title" ASC';
'"DataObjectTest_Team"."Created", "DataObjectTest_Team"."Title", ' .
'"DataObjectTest_SubTeam"."SubclassDatabaseField", "DataObjectTest_Team"."ID", CASE WHEN ' .
'"DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' .
$db->quoteString(Team::class).' END AS "RecordClassName" FROM "DataObjectTest_Team" ' .
'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" WHERE ' .
'("DataObjectTest_Team"."ClassName" IN (?)) ' .
'ORDER BY "DataObjectTest_Team"."Title" ASC';
$this->assertSQLEquals($expected, $playerList->sql($parameters)); $this->assertSQLEquals($expected, $playerList->sql($parameters));
} }
@ -60,13 +46,7 @@ class DataObjectLazyLoadingTest extends SapphireTest
$db = DB::get_conn(); $db = DB::get_conn();
$playerList = new DataList(SubTeam::class); $playerList = new DataList(SubTeam::class);
$playerList = $playerList->setQueriedColumns(array('Title')); $playerList = $playerList->setQueriedColumns(array('Title'));
$expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . '"DataObjectTest_Team"."Created", "DataObjectTest_Team"."Title", "DataObjectTest_Team"."ID", ' . 'CASE WHEN "DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' . $db->quoteString(Team::class) . ' END AS "RecordClassName" FROM "DataObjectTest_Team" ' . 'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" WHERE ' . '("DataObjectTest_Team"."ClassName" IN (?)) ' . 'ORDER BY "DataObjectTest_Team"."Title" ASC';
'"DataObjectTest_Team"."Created", "DataObjectTest_Team"."Title", "DataObjectTest_Team"."ID", ' .
'CASE WHEN "DataObjectTest_Team"."ClassName" IS NOT NULL THEN "DataObjectTest_Team"."ClassName" ELSE ' .
$db->quoteString(Team::class).' END AS "RecordClassName" FROM "DataObjectTest_Team" ' .
'LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = "DataObjectTest_Team"."ID" WHERE ' .
'("DataObjectTest_Team"."ClassName" IN (?)) ' .
'ORDER BY "DataObjectTest_Team"."Title" ASC';
$this->assertSQLEquals($expected, $playerList->sql($parameters)); $this->assertSQLEquals($expected, $playerList->sql($parameters));
} }
@ -75,14 +55,7 @@ class DataObjectLazyLoadingTest extends SapphireTest
$db = DB::get_conn(); $db = DB::get_conn();
$playerList = new DataList(SubTeam::class); $playerList = new DataList(SubTeam::class);
$playerList = $playerList->setQueriedColumns(array('SubclassDatabaseField')); $playerList = $playerList->setQueriedColumns(array('SubclassDatabaseField'));
$expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . $expected = 'SELECT DISTINCT "DataObjectTest_Team"."ClassName", "DataObjectTest_Team"."LastEdited", ' . '"DataObjectTest_Team"."Created", "DataObjectTest_SubTeam"."SubclassDatabaseField", ' . '"DataObjectTest_Team"."ID", CASE WHEN "DataObjectTest_Team"."ClassName" IS NOT NULL THEN ' . '"DataObjectTest_Team"."ClassName" ELSE ' . $db->quoteString(Team::class) . ' END ' . 'AS "RecordClassName", "DataObjectTest_Team"."Title" ' . 'FROM "DataObjectTest_Team" LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = ' . '"DataObjectTest_Team"."ID" WHERE ("DataObjectTest_Team"."ClassName" IN (?)) ' . 'ORDER BY "DataObjectTest_Team"."Title" ASC';
'"DataObjectTest_Team"."Created", "DataObjectTest_SubTeam"."SubclassDatabaseField", ' .
'"DataObjectTest_Team"."ID", CASE WHEN "DataObjectTest_Team"."ClassName" IS NOT NULL THEN ' .
'"DataObjectTest_Team"."ClassName" ELSE '.$db->quoteString(Team::class).' END ' .
'AS "RecordClassName", "DataObjectTest_Team"."Title" ' .
'FROM "DataObjectTest_Team" LEFT JOIN "DataObjectTest_SubTeam" ON "DataObjectTest_SubTeam"."ID" = ' .
'"DataObjectTest_Team"."ID" WHERE ("DataObjectTest_Team"."ClassName" IN (?)) ' .
'ORDER BY "DataObjectTest_Team"."Title" ASC';
$this->assertSQLEquals($expected, $playerList->sql($parameters)); $this->assertSQLEquals($expected, $playerList->sql($parameters));
} }

View File

@ -155,8 +155,7 @@ class DataObjectTest extends SapphireTest
$helper = $obj->dbObject($field); $helper = $obj->dbObject($field);
$this->assertTrue( $this->assertTrue(
($helper instanceof DBField), ($helper instanceof DBField),
"for {$field} expected helper to be DBField, but was " . "for {$field} expected helper to be DBField, but was " . (is_object($helper) ? get_class($helper) : "null")
(is_object($helper) ? get_class($helper) : "null")
); );
} }
} }

View File

@ -533,8 +533,7 @@ class SecurityTest extends FunctionalTest
} }
$msg = _t( $msg = _t(
'SilverStripe\\Security\\Member.ERRORLOCKEDOUT2', 'SilverStripe\\Security\\Member.ERRORLOCKEDOUT2',
'Your account has been temporarily disabled because of too many failed attempts at ' . 'Your account has been temporarily disabled because of too many failed attempts at ' . 'logging in. Please try again in {count} minutes.',
'logging in. Please try again in {count} minutes.',
null, null,
array('count' => 15) array('count' => 15)
); );

View File

@ -83,8 +83,7 @@ class ShortcodeParserTest extends SapphireTest
{ {
$tests = array( $tests = array(
'[test_shortcode]', '[test_shortcode]',
'[test_shortcode ]', '[test_shortcode,]', '[test_shortcode, ]'. '[test_shortcode ]', '[test_shortcode,]', '[test_shortcode, ]' . '[test_shortcode/]', '[test_shortcode /]', '[test_shortcode,/]', '[test_shortcode, /]'
'[test_shortcode/]', '[test_shortcode /]', '[test_shortcode,/]', '[test_shortcode, /]'
); );
foreach ($tests as $test) { foreach ($tests as $test) {