mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fixing string concat CS issues
This commit is contained in:
parent
ff05a7265e
commit
db610aaf3b
@ -157,8 +157,7 @@ class RSSFeed extends ViewableData
|
||||
{
|
||||
$title = Convert::raw2xml($title);
|
||||
Requirements::insertHeadTags(
|
||||
'<link rel="alternate" type="application/rss+xml" title="' . $title .
|
||||
'" href="' . $url . '" />'
|
||||
'<link rel="alternate" type="application/rss+xml" title="' . $title . '" href="' . $url . '" />'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -130,9 +130,7 @@ class RSSFeed_Entry extends ViewableData
|
||||
}
|
||||
|
||||
throw new BadMethodCallException(
|
||||
get_class($this->failover) .
|
||||
" object has neither an AbsoluteLink nor a Link method." .
|
||||
" Can't put a link in the RSS feed",
|
||||
get_class($this->failover) . " object has neither an AbsoluteLink nor a Link method." . " Can't put a link in the RSS feed",
|
||||
E_USER_WARNING
|
||||
);
|
||||
}
|
||||
|
@ -266,8 +266,7 @@ class RequestHandler extends ViewableData
|
||||
$class = static::class;
|
||||
$latestParams = var_export($request->latestParams(), true);
|
||||
Debug::message(
|
||||
"Rule '{$rule}' matched to action '{$action}' on {$class}. ".
|
||||
"Latest request params: {$latestParams}"
|
||||
"Rule '{$rule}' matched to action '{$action}' on {$class}. " . "Latest request params: {$latestParams}"
|
||||
);
|
||||
}
|
||||
|
||||
@ -566,8 +565,7 @@ class RequestHandler extends ViewableData
|
||||
|
||||
// no link defined by default
|
||||
trigger_error(
|
||||
'Request handler '.static::class. ' does not have a url_segment defined. '.
|
||||
'Relying on this link may be an application error',
|
||||
'Request handler ' . static::class . ' does not have a url_segment defined. ' . 'Relying on this link may be an application error',
|
||||
E_USER_WARNING
|
||||
);
|
||||
return null;
|
||||
|
@ -76,9 +76,7 @@ class TempFolder
|
||||
}
|
||||
|
||||
// failing the above, try finding a namespaced silverstripe-cache dir in the system temp
|
||||
$tempPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR .
|
||||
'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION) .
|
||||
str_replace(array(' ', '/', ':', '\\'), '-', $base);
|
||||
$tempPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION) . str_replace(array(' ', '/', ':', '\\'), '-', $base);
|
||||
if (!@file_exists($tempPath)) {
|
||||
$oldUMask = umask(0);
|
||||
@mkdir($tempPath, 0777);
|
||||
@ -107,9 +105,7 @@ class TempFolder
|
||||
|
||||
if (!$worked) {
|
||||
throw new Exception(
|
||||
'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'
|
||||
'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'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -247,8 +247,7 @@ class MySQLDatabaseConfigurationHelper implements DatabaseConfigurationHelper
|
||||
preg_quote('"%".*'),
|
||||
preg_quote('*.*')
|
||||
);
|
||||
$expression = '/GRANT[ ,\w]+((ALL PRIVILEGES)|('.$permission.'(?! ((VIEW)|(ROUTINE)))))[ ,\w]+ON '.
|
||||
$dbPattern.'/i';
|
||||
$expression = '/GRANT[ ,\w]+((ALL PRIVILEGES)|(' . $permission . '(?! ((VIEW)|(ROUTINE)))))[ ,\w]+ON ' . $dbPattern . '/i';
|
||||
return preg_match($expression, $grant);
|
||||
}
|
||||
|
||||
|
@ -144,8 +144,7 @@ class FormRequestHandler extends RequestHandler
|
||||
if (empty($vars[$securityID])) {
|
||||
$this->httpError(400, _t(
|
||||
"SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE",
|
||||
"There seems to have been a technical problem. Please click the back button, ".
|
||||
"refresh your browser, and try again."
|
||||
"There seems to have been a technical problem. Please click the back button, " . "refresh your browser, and try again."
|
||||
));
|
||||
} else {
|
||||
// Clear invalid token on refresh
|
||||
@ -258,8 +257,7 @@ class FormRequestHandler extends RequestHandler
|
||||
$legacyActions = $this->form->config()->get('allowed_actions');
|
||||
if ($legacyActions) {
|
||||
throw new BadMethodCallException(
|
||||
"allowed_actions are not valid on Form class " . get_class($this->form) .
|
||||
". Implement these in subclasses of " . static::class . " instead"
|
||||
"allowed_actions are not valid on Form class " . get_class($this->form) . ". Implement these in subclasses of " . static::class . " instead"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -897,8 +897,7 @@ class GridField extends FormField
|
||||
if (!$token->checkRequest($request)) {
|
||||
$this->httpError(400, _t(
|
||||
"SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE",
|
||||
"There seems to have been a technical problem. Please click the back button, ".
|
||||
"refresh your browser, and try again."
|
||||
"There seems to have been a technical problem. Please click the back button, " . "refresh your browser, and try again."
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -51,8 +51,7 @@ class GridFieldPageCount implements GridField_HTMLProvider
|
||||
|
||||
if (!$paginator && GridFieldPageCount::config()->uninherited('require_paginator')) {
|
||||
throw new LogicException(
|
||||
static::class . " relies on a GridFieldPaginator to be added " .
|
||||
"to the same GridField, but none are present."
|
||||
static::class . " relies on a GridFieldPaginator to be added " . "to the same GridField, but none are present."
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -168,8 +168,7 @@ SCRIPT;
|
||||
// Join list of paths
|
||||
$filesList = Convert::raw2js(implode(',', $fileURLS));
|
||||
// Mark all themes, plugins and languages as done
|
||||
$buffer[] = "window.tinymce.each('$filesList'.split(',')," .
|
||||
"function(f){tinymce.ScriptLoader.markDone(baseURL+f);});";
|
||||
$buffer[] = "window.tinymce.each('$filesList'.split(',')," . "function(f){tinymce.ScriptLoader.markDone(baseURL+f);});";
|
||||
|
||||
$buffer[] = '})();';
|
||||
return implode("\n", $buffer) . "\n";
|
||||
|
@ -198,8 +198,7 @@ PHP
|
||||
$controller = $controller->customise(array(
|
||||
'Content' => DBField::create_field(DBHTMLText::class, _t(
|
||||
__CLASS__ . '.SUCCESSCONTENT',
|
||||
'<p>Login success. If you are not automatically redirected ' .
|
||||
'<a target="_top" href="{link}">click here</a></p>',
|
||||
'<p>Login success. If you are not automatically redirected ' . '<a target="_top" href="{link}">click here</a></p>',
|
||||
'Login message displayed in the cms popup once a user has re-authenticated themselves',
|
||||
array('link' => Convert::raw2att($backURL))
|
||||
))
|
||||
|
@ -306,8 +306,7 @@ class InheritedPermissions implements PermissionChecker
|
||||
$baseTable = DataObject::getSchema()->baseDataTable($this->getBaseClass());
|
||||
$uninheritedPermissions = $stageRecords
|
||||
->where([
|
||||
"(\"$typeField\" IN (?, ?) OR " .
|
||||
"(\"$typeField\" = ? AND \"$groupJoinTable\".\"{$baseTable}ID\" IS NOT NULL))"
|
||||
"(\"$typeField\" IN (?, ?) OR " . "(\"$typeField\" = ? AND \"$groupJoinTable\".\"{$baseTable}ID\" IS NOT NULL))"
|
||||
=> [
|
||||
self::ANYONE,
|
||||
self::LOGGED_IN_USERS,
|
||||
@ -316,8 +315,7 @@ class InheritedPermissions implements PermissionChecker
|
||||
])
|
||||
->leftJoin(
|
||||
$groupJoinTable,
|
||||
"\"$groupJoinTable\".\"{$baseTable}ID\" = \"{$baseTable}\".\"ID\" AND " .
|
||||
"\"$groupJoinTable\".\"GroupID\" IN ($groupIDsSQLList)"
|
||||
"\"$groupJoinTable\".\"{$baseTable}ID\" = \"{$baseTable}\".\"ID\" AND " . "\"$groupJoinTable\".\"GroupID\" IN ($groupIDsSQLList)"
|
||||
)->column('ID');
|
||||
} else {
|
||||
// Only view pages with ViewType = Anyone if not logged in
|
||||
|
@ -351,8 +351,7 @@ class Member extends DataObject
|
||||
$result->addError(
|
||||
_t(
|
||||
__CLASS__ . '.ERRORLOCKEDOUT2',
|
||||
'Your account has been temporarily disabled because of too many failed attempts at ' .
|
||||
'logging in. Please try again in {count} minutes.',
|
||||
'Your account has been temporarily disabled because of too many failed attempts at ' . 'logging in. Please try again in {count} minutes.',
|
||||
null,
|
||||
array('count' => static::config()->get('lock_out_delay_mins'))
|
||||
)
|
||||
|
@ -22,8 +22,7 @@ class HTML4Value extends HTMLValue
|
||||
|
||||
$errorState = libxml_use_internal_errors(true);
|
||||
$result = $this->getDocument()->loadHTML(
|
||||
'<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head>' .
|
||||
"<body>$content</body></html>"
|
||||
'<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head>' . "<body>$content</body></html>"
|
||||
);
|
||||
libxml_clear_errors();
|
||||
libxml_use_internal_errors($errorState);
|
||||
|
@ -374,11 +374,9 @@ class ShortcodeParser
|
||||
if ($i == 0) {
|
||||
$err = 'Close tag "' . $tags[$i]['close'] . '" is the first found tag, so has no related open tag';
|
||||
} elseif (!$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'] . '"';
|
||||
} elseif ($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) {
|
||||
@ -599,8 +597,7 @@ class ShortcodeParser
|
||||
elseif ($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
|
||||
);
|
||||
}
|
||||
|
@ -44,9 +44,7 @@ class ViewableData_Debugger extends ViewableData
|
||||
// debugging info for a specific field
|
||||
$class = get_class($this->object);
|
||||
if ($field) {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
// debugging information for the entire class
|
||||
|
@ -1,9 +1,7 @@
|
||||
<?php
|
||||
|
||||
if (!defined('BASE_PATH')) {
|
||||
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";
|
||||
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";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -108,40 +108,35 @@ class ControllerTest extends FunctionalTest
|
||||
$this->assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
'Access granted on index action without $allowed_actions on defining controller, ' .
|
||||
'when called without an action in the URL'
|
||||
'Access granted on index action without $allowed_actions on defining controller, ' . 'when called without an action in the URL'
|
||||
);
|
||||
|
||||
$response = $this->get("UnsecuredController/index");
|
||||
$this->assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
'Access denied on index action without $allowed_actions on defining controller, ' .
|
||||
'when called with an action in the URL'
|
||||
'Access denied on index action without $allowed_actions on defining controller, ' . 'when called with an action in the URL'
|
||||
);
|
||||
|
||||
$response = $this->get("UnsecuredController/method1");
|
||||
$this->assertEquals(
|
||||
403,
|
||||
$response->getStatusCode(),
|
||||
'Access denied on action without $allowed_actions on defining controller, ' .
|
||||
'when called without an action in the URL'
|
||||
'Access denied on action without $allowed_actions on defining controller, ' . 'when called without an action in the URL'
|
||||
);
|
||||
|
||||
$response = $this->get("AccessBaseController/");
|
||||
$this->assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
'Access granted on index with empty $allowed_actions on defining controller, ' .
|
||||
'when called without an action in the URL'
|
||||
'Access granted on index with empty $allowed_actions on defining controller, ' . 'when called without an action in the URL'
|
||||
);
|
||||
|
||||
$response = $this->get("AccessBaseController/index");
|
||||
$this->assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
'Access granted on index with empty $allowed_actions on defining controller, ' .
|
||||
'when called with an action in the URL'
|
||||
'Access granted on index with empty $allowed_actions on defining controller, ' . 'when called with an action in the URL'
|
||||
);
|
||||
|
||||
$response = $this->get("AccessBaseController/method1");
|
||||
@ -155,48 +150,42 @@ class ControllerTest extends FunctionalTest
|
||||
$this->assertEquals(
|
||||
403,
|
||||
$response->getStatusCode(),
|
||||
'Access denied on action with empty $allowed_actions on defining controller, ' .
|
||||
'even when action is allowed in subclasses (allowed_actions don\'t inherit)'
|
||||
'Access denied on action with empty $allowed_actions on defining controller, ' . 'even when action is allowed in subclasses (allowed_actions don\'t inherit)'
|
||||
);
|
||||
|
||||
$response = $this->get("AccessSecuredController/");
|
||||
$this->assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
'Access granted on index with non-empty $allowed_actions on defining controller, ' .
|
||||
'even when index isn\'t specifically mentioned in there'
|
||||
'Access granted on index with non-empty $allowed_actions on defining controller, ' . 'even when index isn\'t specifically mentioned in there'
|
||||
);
|
||||
|
||||
$response = $this->get("AccessSecuredController/method1");
|
||||
$this->assertEquals(
|
||||
403,
|
||||
$response->getStatusCode(),
|
||||
'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)'
|
||||
'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)'
|
||||
);
|
||||
|
||||
$response = $this->get("AccessSecuredController/method2");
|
||||
$this->assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
'Access granted on action originally defined with empty $allowed_actions on parent controller, ' .
|
||||
'because it has been redefined in the subclass'
|
||||
'Access granted on action originally defined with empty $allowed_actions on parent controller, ' . 'because it has been redefined in the subclass'
|
||||
);
|
||||
|
||||
$response = $this->get("AccessSecuredController/templateaction");
|
||||
$this->assertEquals(
|
||||
403,
|
||||
$response->getStatusCode(),
|
||||
'Access denied on action with $allowed_actions on defining controller, ' .
|
||||
'if action is not a method but rather a template discovered by naming convention'
|
||||
'Access denied on action with $allowed_actions on defining controller, ' . 'if action is not a method but rather a template discovered by naming convention'
|
||||
);
|
||||
|
||||
$response = $this->get("AccessSecuredController/templateaction");
|
||||
$this->assertEquals(
|
||||
403,
|
||||
$response->getStatusCode(),
|
||||
'Access denied on action with $allowed_actions on defining controller, ' .
|
||||
'if action is not a method but rather a template discovered by naming convention'
|
||||
'Access denied on action with $allowed_actions on defining controller, ' . 'if action is not a method but rather a template discovered by naming convention'
|
||||
);
|
||||
|
||||
Security::setCurrentUser($adminUser);
|
||||
@ -204,8 +193,7 @@ class ControllerTest extends FunctionalTest
|
||||
$this->assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
'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'
|
||||
'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'
|
||||
);
|
||||
|
||||
Security::setCurrentUser(null);
|
||||
@ -213,16 +201,14 @@ class ControllerTest extends FunctionalTest
|
||||
$this->assertEquals(
|
||||
403,
|
||||
$response->getStatusCode(),
|
||||
'Access denied on action with $allowed_actions on defining controller, ' .
|
||||
'when restricted by unmatched permission code'
|
||||
'Access denied on action with $allowed_actions on defining controller, ' . 'when restricted by unmatched permission code'
|
||||
);
|
||||
|
||||
$response = $this->get("AccessSecuredController/aDmiNOnlY");
|
||||
$this->assertEquals(
|
||||
403,
|
||||
$response->getStatusCode(),
|
||||
'Access denied on action with $allowed_actions on defining controller, ' .
|
||||
'regardless of capitalization'
|
||||
'Access denied on action with $allowed_actions on defining controller, ' . 'regardless of capitalization'
|
||||
);
|
||||
|
||||
$response = $this->get('AccessSecuredController/protectedmethod');
|
||||
@ -245,40 +231,35 @@ class ControllerTest extends FunctionalTest
|
||||
$this->assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Access granted to method defined in allowed_actions on extension, " .
|
||||
"where method is also defined on extension"
|
||||
"Access granted to method defined in allowed_actions on extension, " . "where method is also defined on extension"
|
||||
);
|
||||
|
||||
$response = $this->get('AccessSecuredController/extensionmethod1');
|
||||
$this->assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Access granted to method defined in allowed_actions on extension, " .
|
||||
"where method is also defined on extension, even when called in a subclass"
|
||||
"Access granted to method defined in allowed_actions on extension, " . "where method is also defined on extension, even when called in a subclass"
|
||||
);
|
||||
|
||||
$response = $this->get('AccessBaseController/extensionmethod2');
|
||||
$this->assertEquals(
|
||||
404,
|
||||
$response->getStatusCode(),
|
||||
"Access denied to method not defined in allowed_actions on extension, " .
|
||||
"where method is also defined on extension"
|
||||
"Access denied to method not defined in allowed_actions on extension, " . "where method is also defined on extension"
|
||||
);
|
||||
|
||||
$response = $this->get('IndexSecuredController/');
|
||||
$this->assertEquals(
|
||||
403,
|
||||
$response->getStatusCode(),
|
||||
"Access denied when index action is limited through allowed_actions, " .
|
||||
"and doesn't satisfy checks, and action is empty"
|
||||
"Access denied when index action is limited through allowed_actions, " . "and doesn't satisfy checks, and action is empty"
|
||||
);
|
||||
|
||||
$response = $this->get('IndexSecuredController/index');
|
||||
$this->assertEquals(
|
||||
403,
|
||||
$response->getStatusCode(),
|
||||
"Access denied when index action is limited through allowed_actions, " .
|
||||
"and doesn't satisfy checks"
|
||||
"Access denied when index action is limited through allowed_actions, " . "and doesn't satisfy checks"
|
||||
);
|
||||
|
||||
Security::setCurrentUser($adminUser);
|
||||
@ -286,8 +267,7 @@ class ControllerTest extends FunctionalTest
|
||||
$this->assertEquals(
|
||||
200,
|
||||
$response->getStatusCode(),
|
||||
"Access granted when index action is limited through allowed_actions, " .
|
||||
"and does satisfy checks"
|
||||
"Access granted when index action is limited through allowed_actions, " . "and does satisfy checks"
|
||||
);
|
||||
Security::setCurrentUser(null);
|
||||
}
|
||||
@ -433,8 +413,7 @@ class ControllerTest extends FunctionalTest
|
||||
|
||||
$this->assertFalse(
|
||||
$securedController->hasAction('protectedextensionmethod'),
|
||||
'Method is not visible when defined on an extension, part of allowed_actions, ' .
|
||||
'but with protected visibility'
|
||||
'Method is not visible when defined on an extension, part of allowed_actions, ' . 'but with protected visibility'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -226,8 +226,7 @@ class HTTPTest extends FunctionalTest
|
||||
// background-image
|
||||
// Note that using /./ in urls is absolutely acceptable
|
||||
$this->assertEquals(
|
||||
'<div style="background-image: url(\'http://www.silverstripe.org/./images/mybackground.gif\');">'.
|
||||
'Content</div>',
|
||||
'<div style="background-image: url(\'http://www.silverstripe.org/./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
|
||||
// Note that using /./ in urls is absolutely acceptable
|
||||
$this->assertEquals(
|
||||
'<div background="http://www.silverstripe.org/./themes/silverstripe/images/nav-bg-repeat-2.png">'.
|
||||
'SS Blog</div>',
|
||||
'<div background="http://www.silverstripe.org/./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
|
||||
$this->assertEquals(
|
||||
'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38'.
|
||||
'GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />',
|
||||
'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38' . 'GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />',
|
||||
HTTP::absoluteURLs(
|
||||
'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH'.
|
||||
'ElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />'
|
||||
'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH' . 'ElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />'
|
||||
),
|
||||
'Data URI links are not rewritten'
|
||||
);
|
||||
|
@ -136,12 +136,7 @@ class ConvertTest extends SapphireTest
|
||||
"Single quotes are decoded correctly"
|
||||
);
|
||||
|
||||
$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.';
|
||||
$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.';
|
||||
$this->assertEquals($val8, Convert::html2raw($val8), 'Test long text is unwrapped');
|
||||
$this->assertEquals(
|
||||
<<<PHP
|
||||
|
@ -29,8 +29,7 @@ class CoreTest extends SapphireTest
|
||||
$this->assertEquals(TempFolder::getTempFolder(BASE_PATH), $this->tempPath . DIRECTORY_SEPARATOR . $user);
|
||||
} else {
|
||||
$user = TempFolder::getTempFolderUsername();
|
||||
$base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' .
|
||||
preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION);
|
||||
$base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION);
|
||||
|
||||
// A typical Windows location for where sites are stored on IIS
|
||||
$this->assertEquals(
|
||||
@ -56,8 +55,7 @@ class CoreTest extends SapphireTest
|
||||
{
|
||||
parent::tearDown();
|
||||
$user = TempFolder::getTempFolderUsername();
|
||||
$base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' .
|
||||
preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION);
|
||||
$base = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'silverstripe-cache-php' . preg_replace('/[^\w-\.+]+/', '-', PHP_VERSION);
|
||||
foreach (array(
|
||||
'C--inetpub-wwwroot-silverstripe-test-project',
|
||||
'-Users-joebloggs-Sites-silverstripe-test-project',
|
||||
|
@ -109,8 +109,7 @@ class FixtureBlueprintTest extends SapphireTest
|
||||
'one',
|
||||
array(
|
||||
'ManyManyRelation' =>
|
||||
'=>'.DataObjectRelation::class.'.relation1,' .
|
||||
'=>'.DataObjectRelation::class.'.relation2'
|
||||
'=>' . DataObjectRelation::class . '.relation1,' . '=>' . DataObjectRelation::class . '.relation2'
|
||||
),
|
||||
array(
|
||||
DataObjectRelation::class => array(
|
||||
|
@ -95,8 +95,7 @@ class GridFieldDeleteActionTest extends SapphireTest
|
||||
$this->expectException(HTTPResponse_Exception::class);
|
||||
$this->expectExceptionMessage(_t(
|
||||
"SilverStripe\\Forms\\Form.CSRF_FAILED_MESSAGE",
|
||||
"There seems to have been a technical problem. Please click the back button, ".
|
||||
"refresh your browser, and try again."
|
||||
"There seems to have been a technical problem. Please click the back button, " . "refresh your browser, and try again."
|
||||
));
|
||||
$this->expectExceptionCode(400);
|
||||
$stateID = 'testGridStateActionField';
|
||||
|
@ -66,9 +66,7 @@ class GridFieldExportButtonTest extends SapphireTest
|
||||
$button->setExportColumns(['Name' => 'My Name']);
|
||||
|
||||
$this->assertEquals(
|
||||
'"My Name"'."\n".
|
||||
'Test'."\n".
|
||||
'Test2'."\n",
|
||||
'"My Name"' . "\n" . 'Test' . "\n" . 'Test2' . "\n",
|
||||
$button->generateExportFileData($this->gridField)
|
||||
);
|
||||
}
|
||||
@ -101,9 +99,7 @@ class GridFieldExportButtonTest extends SapphireTest
|
||||
]);
|
||||
|
||||
$this->assertEquals(
|
||||
'Name,City'."\n".
|
||||
'Test,"City city"'."\n".
|
||||
'Test2,"Quoted ""City"" 2 city"'."\n",
|
||||
'Name,City' . "\n" . 'Test,"City city"' . "\n" . 'Test2,"Quoted ""City"" 2 city"' . "\n",
|
||||
$button->generateExportFileData($this->gridField)
|
||||
);
|
||||
}
|
||||
@ -117,9 +113,7 @@ class GridFieldExportButtonTest extends SapphireTest
|
||||
]);
|
||||
|
||||
$this->assertEquals(
|
||||
'Name,strtolower'."\n".
|
||||
'Test,City'."\n".
|
||||
'Test2,"Quoted ""City"" 2"'."\n",
|
||||
'Name,strtolower' . "\n" . 'Test,City' . "\n" . 'Test2,"Quoted ""City"" 2"' . "\n",
|
||||
$button->generateExportFileData($this->gridField)
|
||||
);
|
||||
}
|
||||
@ -134,8 +128,7 @@ class GridFieldExportButtonTest extends SapphireTest
|
||||
$button->setCsvHasHeader(false);
|
||||
|
||||
$this->assertEquals(
|
||||
'Test,City'."\n".
|
||||
'Test2,"Quoted ""City"" 2"'."\n",
|
||||
'Test,City' . "\n" . 'Test2,"Quoted ""City"" 2"' . "\n",
|
||||
$button->generateExportFileData($this->gridField)
|
||||
);
|
||||
}
|
||||
@ -154,23 +147,7 @@ class GridFieldExportButtonTest extends SapphireTest
|
||||
$this->gridField->setList($arrayList);
|
||||
|
||||
$this->assertEquals(
|
||||
"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",
|
||||
"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",
|
||||
$button->generateExportFileData($this->gridField)
|
||||
);
|
||||
}
|
||||
|
@ -111,8 +111,7 @@ class TreeDropdownFieldTest extends SapphireTest
|
||||
$folder1Subfolder1 = $this->objFromFixture(Folder::class, 'folder1-subfolder1');
|
||||
|
||||
$parser = new CSSContentParser($tree);
|
||||
$cssPath = 'ul.tree li#selector-TestTree-'.$folder1->ID.' li#selector-TestTree-'.
|
||||
$folder1Subfolder1->ID.' a span.item';
|
||||
$cssPath = 'ul.tree li#selector-TestTree-' . $folder1->ID . ' li#selector-TestTree-' . $folder1Subfolder1->ID . ' a span.item';
|
||||
$firstResult = $parser->getBySelector($cssPath);
|
||||
$this->assertEquals(
|
||||
$folder1Subfolder1->Name,
|
||||
@ -149,8 +148,7 @@ class TreeDropdownFieldTest extends SapphireTest
|
||||
$parser = new CSSContentParser($tree);
|
||||
|
||||
// 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-'.
|
||||
$folder1Subfolder1->ID.' a span.item';
|
||||
$cssPath = 'ul.tree li#selector-TestTree-' . $folder1->ID . ' li#selector-TestTree-' . $folder1Subfolder1->ID . ' a span.item';
|
||||
$firstResult = $parser->getBySelector($cssPath);
|
||||
$this->assertEquals(
|
||||
$folder1Subfolder1->Name,
|
||||
|
@ -28,14 +28,7 @@ class DataObjectLazyLoadingTest extends SapphireTest
|
||||
$db = DB::get_conn();
|
||||
$playerList = new DataList(SubTeam::class);
|
||||
$playerList = $playerList->setQueriedColumns(array('ID'));
|
||||
$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';
|
||||
$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';
|
||||
$this->assertSQLEquals($expected, $playerList->sql($parameters));
|
||||
}
|
||||
|
||||
@ -44,14 +37,7 @@ class DataObjectLazyLoadingTest extends SapphireTest
|
||||
$db = DB::get_conn();
|
||||
$playerList = new DataList(SubTeam::class);
|
||||
$playerList = $playerList->setQueriedColumns(array('Title', 'SubclassDatabaseField'));
|
||||
$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';
|
||||
$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';
|
||||
$this->assertSQLEquals($expected, $playerList->sql($parameters));
|
||||
}
|
||||
|
||||
@ -60,13 +46,7 @@ class DataObjectLazyLoadingTest extends SapphireTest
|
||||
$db = DB::get_conn();
|
||||
$playerList = new DataList(SubTeam::class);
|
||||
$playerList = $playerList->setQueriedColumns(array('Title'));
|
||||
$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';
|
||||
$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';
|
||||
$this->assertSQLEquals($expected, $playerList->sql($parameters));
|
||||
}
|
||||
|
||||
@ -75,14 +55,7 @@ class DataObjectLazyLoadingTest extends SapphireTest
|
||||
$db = DB::get_conn();
|
||||
$playerList = new DataList(SubTeam::class);
|
||||
$playerList = $playerList->setQueriedColumns(array('SubclassDatabaseField'));
|
||||
$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';
|
||||
$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';
|
||||
$this->assertSQLEquals($expected, $playerList->sql($parameters));
|
||||
}
|
||||
|
||||
|
@ -155,8 +155,7 @@ class DataObjectTest extends SapphireTest
|
||||
$helper = $obj->dbObject($field);
|
||||
$this->assertTrue(
|
||||
($helper instanceof DBField),
|
||||
"for {$field} expected helper to be DBField, but was " .
|
||||
(is_object($helper) ? get_class($helper) : "null")
|
||||
"for {$field} expected helper to be DBField, but was " . (is_object($helper) ? get_class($helper) : "null")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -533,8 +533,7 @@ class SecurityTest extends FunctionalTest
|
||||
}
|
||||
$msg = _t(
|
||||
'SilverStripe\\Security\\Member.ERRORLOCKEDOUT2',
|
||||
'Your account has been temporarily disabled because of too many failed attempts at ' .
|
||||
'logging in. Please try again in {count} minutes.',
|
||||
'Your account has been temporarily disabled because of too many failed attempts at ' . 'logging in. Please try again in {count} minutes.',
|
||||
null,
|
||||
array('count' => 15)
|
||||
);
|
||||
|
@ -83,8 +83,7 @@ class ShortcodeParserTest extends SapphireTest
|
||||
{
|
||||
$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, /]'
|
||||
);
|
||||
|
||||
foreach ($tests as $test) {
|
||||
|
Loading…
Reference in New Issue
Block a user