Révision b4adf10d
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/modules/simpletest/tests/common.test | ||
---|---|---|
661 | 661 |
drupal_add_css($css); |
662 | 662 |
$styles = drupal_get_css(); |
663 | 663 |
$this->assertTrue(strpos($styles, $css) > 0, 'Rendered CSS includes the added stylesheet.'); |
664 |
// Verify that newlines are properly added inside style tags. |
|
665 |
$query_string = variable_get('css_js_query_string', '0'); |
|
666 |
$css_processed = "<style type=\"text/css\" media=\"all\">\n@import url(\"" . check_plain(file_create_url($css)) . "?" . $query_string ."\");\n</style>"; |
|
667 |
$this->assertEqual(trim($styles), $css_processed, 'Rendered CSS includes newlines inside style tags for JavaScript use.'); |
|
664 | 668 |
} |
665 | 669 |
|
666 | 670 |
/** |
... | ... | |
914 | 918 |
* Tests basic CSS loading with and without optimization via drupal_load_stylesheet(). |
915 | 919 |
* |
916 | 920 |
* Known tests: |
917 |
* - Retain white-space in selectors. (http://drupal.org/node/472820) |
|
918 |
* - Proper URLs in imported files. (http://drupal.org/node/265719) |
|
919 |
* - Retain pseudo-selectors. (http://drupal.org/node/460448) |
|
921 |
* - Retain white-space in selectors. (https://drupal.org/node/472820) |
|
922 |
* - Proper URLs in imported files. (https://drupal.org/node/265719) |
|
923 |
* - Retain pseudo-selectors. (https://drupal.org/node/460448) |
|
924 |
* - Don't adjust data URIs. (https://drupal.org/node/2142441) |
|
920 | 925 |
*/ |
921 | 926 |
function testLoadCssBasic() { |
922 | 927 |
// Array of files to test living in 'simpletest/files/css_test_files/'. |
... | ... | |
1082 | 1087 |
} |
1083 | 1088 |
} |
1084 | 1089 |
|
1090 |
/** |
|
1091 |
* Tests parsing of the HTTP response status line. |
|
1092 |
*/ |
|
1093 |
class DrupalHTTPResponseStatusLineTest extends DrupalUnitTestCase { |
|
1094 |
public static function getInfo() { |
|
1095 |
return array( |
|
1096 |
'name' => 'Drupal HTTP request response status parsing', |
|
1097 |
'description' => 'Perform unit tests on _drupal_parse_response_status().', |
|
1098 |
'group' => 'System', |
|
1099 |
); |
|
1100 |
} |
|
1101 |
|
|
1102 |
/** |
|
1103 |
* Tests parsing HTTP response status line. |
|
1104 |
*/ |
|
1105 |
public function testStatusLine() { |
|
1106 |
// Grab the big array of test data from statusLineData(). |
|
1107 |
$data = $this->statusLineData(); |
|
1108 |
foreach($data as $test_case) { |
|
1109 |
$test_data = array_shift($test_case); |
|
1110 |
$expected = array_shift($test_case); |
|
1111 |
|
|
1112 |
$outcome = _drupal_parse_response_status($test_data); |
|
1113 |
|
|
1114 |
foreach(array_keys($expected) as $key) { |
|
1115 |
$this->assertIdentical($outcome[$key], $expected[$key]); |
|
1116 |
} |
|
1117 |
} |
|
1118 |
} |
|
1119 |
|
|
1120 |
/** |
|
1121 |
* Data provider for testStatusLine(). |
|
1122 |
* |
|
1123 |
* @return array |
|
1124 |
* Test data. |
|
1125 |
*/ |
|
1126 |
protected function statusLineData() { |
|
1127 |
return array( |
|
1128 |
array( |
|
1129 |
'HTTP/1.1 200 OK', |
|
1130 |
array( |
|
1131 |
'http_version' => 'HTTP/1.1', |
|
1132 |
'response_code' => '200', |
|
1133 |
'reason_phrase' => 'OK', |
|
1134 |
), |
|
1135 |
), |
|
1136 |
// Data set with no reason phrase. |
|
1137 |
array( |
|
1138 |
'HTTP/1.1 200', |
|
1139 |
array( |
|
1140 |
'http_version' => 'HTTP/1.1', |
|
1141 |
'response_code' => '200', |
|
1142 |
'reason_phrase' => '', |
|
1143 |
), |
|
1144 |
), |
|
1145 |
// Arbitrary strings. |
|
1146 |
array( |
|
1147 |
'version code multi word explanation', |
|
1148 |
array( |
|
1149 |
'http_version' => 'version', |
|
1150 |
'response_code' => 'code', |
|
1151 |
'reason_phrase' => 'multi word explanation', |
|
1152 |
), |
|
1153 |
), |
|
1154 |
); |
|
1155 |
} |
|
1156 |
} |
|
1157 |
|
|
1085 | 1158 |
/** |
1086 | 1159 |
* Testing drupal_add_region_content and drupal_get_region_content. |
1087 | 1160 |
*/ |
Formats disponibles : Unified diff
Udpate to 7.33