Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
104b4360
Commit
104b4360
authored
11 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2026255
by Wim Leers: Make CascadingStylesheetsTest 3500% faster.
parent
af5478b8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
+11
-39
11 additions, 39 deletions
...b/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
with
11 additions
and
39 deletions
core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php
+
11
−
39
View file @
104b4360
...
...
@@ -8,19 +8,19 @@
namespace
Drupal\system\Tests\Common
;
use
Drupal\Core\Language\Language
;
use
Drupal\simpletest\
Web
TestBase
;
use
Drupal\simpletest\
DrupalUnit
TestBase
;
/**
* Tests the Drupal CSS system.
*/
class
CascadingStylesheetsTest
extends
Web
TestBase
{
class
CascadingStylesheetsTest
extends
DrupalUnit
TestBase
{
/**
* Modules to enable.
*
* @var array
*/
public
static
$modules
=
array
(
'language'
,
'
common_test
'
);
public
static
$modules
=
array
(
'language'
,
'
system
'
);
public
static
function
getInfo
()
{
return
array
(
...
...
@@ -116,39 +116,6 @@ function testRenderInlineNoPreprocess() {
$this
->
assertTrue
(
strpos
(
$styles
,
$css
)
>
0
,
'Rendering non-preprocessed inline CSS adds it to the page.'
);
}
/**
* Tests rendering inline stylesheets through a full page request.
*/
function
testRenderInlineFullPage
()
{
module_enable
(
array
(
'php'
));
$css
=
'body { font-size: 254px; }'
;
// Inline CSS is minified unless 'preprocess' => FALSE is passed as a
// drupal_add_css() option.
$expected
=
'body{font-size:254px;}'
;
// Create Basic page node type.
$this
->
drupalCreateContentType
(
array
(
'type'
=>
'page'
,
'name'
=>
'Basic page'
));
// Create a node, using the PHP filter that tests drupal_add_css().
$php_format_id
=
'php_code'
;
$settings
=
array
(
'type'
=>
'page'
,
'body'
=>
array
(
array
(
'value'
=>
t
(
'This tests the inline CSS!'
)
.
"<?php drupal_add_css('
$css
', 'inline'); ?>"
,
'format'
=>
$php_format_id
,
),
),
'promote'
=>
1
,
);
$node
=
$this
->
drupalCreateNode
(
$settings
);
// Fetch the page.
$this
->
drupalGet
(
'node/'
.
$node
->
nid
);
$this
->
assertRaw
(
$expected
,
'Inline stylesheets appear in the full page rendering.'
);
}
/**
* Tests CSS ordering.
*/
...
...
@@ -225,9 +192,14 @@ function testAlter() {
* Tests that CSS query string remains intact when added to file.
*/
function
testAddCssFileWithQueryString
()
{
$this
->
drupalGet
(
'common-test/query-string'
);
$css_without_query_string
=
drupal_get_path
(
'module'
,
'node'
)
.
'/css/node.admin.css'
;
$css_with_query_string
=
'/'
.
drupal_get_path
(
'module'
,
'node'
)
.
'/node-fake.css?arg1=value1&arg2=value2'
;
drupal_add_css
(
$css_without_query_string
);
drupal_add_css
(
$css_with_query_string
);
$styles
=
drupal_get_css
();
$query_string
=
variable_get
(
'css_js_query_string'
,
'0'
);
$this
->
assert
Raw
(
drupal_get_path
(
'modu
le
'
,
'node'
)
.
'/css/node.admin.css
?'
.
$query_string
,
'Query string was appended correctly to css.'
);
$this
->
assert
Raw
(
drupal_get_path
(
'module'
,
'node'
)
.
'/node-fake.css?arg1=value1&arg2=value2'
,
'Query string not escaped on a URI.'
);
$this
->
assert
True
(
strpos
(
$sty
le
s
,
$css_without_query_string
.
'
?'
.
$query_string
)
,
'Query string was appended correctly to css.'
);
$this
->
assert
True
(
strpos
(
$styles
,
str_replace
(
'&'
,
'&'
,
$css_with_query_string
))
,
'Query string not escaped on a URI.'
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment