MDL-38352 behat: Removing extra double quotes escape

This commit is contained in:
David Monllao
2013-03-11 12:52:12 +08:00
parent 8673a98d1d
commit e88d47b4a2
2 changed files with 4 additions and 19 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ class nasty_strings {
'\' \\" \ \'$@NULL@$ @@TEST@@ < > & &lt; &gt; &amp; \\\" \\ , ; : . 日本語­% %%',
'\\\" \\ , ; : . 日本語­% < > & &lt; &gt; &amp; \' \\" \ \'$@NULL@$ @@TEST@@ %%',
'< > & &lt; &gt; &amp; \' \\" \ \'$@NULL@$ 日本語­% %% @@TEST@@ \\\" \\ . , ; :',
'. 日本語&amp; \' \\"< > & &lt; &gt; \\\" \\ , ; : \ \'$@NULL@$ @@TEST@@­% %%',
'. 日本語&amp; \' \\" < > & &lt; &gt; \\ , ; : \ \'$@NULL@$ \\\" @@TEST@@­% %%',
'&amp; \' \\" \ < > & &lt; &gt; \\\" \\ , ; : . 日本語\'$@NULL@$ @@TEST@@­% %%',
);
+3 -18
View File
@@ -56,7 +56,7 @@ class behat_transformations extends behat_base {
* @return string The string with the arguments fixed.
*/
public function arg_replace_slashes($string) {
return $this->replace_slashes($string);
return str_replace('\"', '"', $string);
}
/**
@@ -73,8 +73,8 @@ class behat_transformations extends behat_base {
/**
* Transformations for TableNode arguments.
*
* All the transformations have to be applied to tables,
* adding them in a different method for Behat API restrictions.
* Transformations applicable to TableNode arguments should also
* be applied, adding them in a different method for Behat API restrictions.
*
* @Transform /^table:(.*)/
* @param TableNode $tablenode
@@ -87,9 +87,6 @@ class behat_transformations extends behat_base {
foreach ($rows as $rowkey => $row) {
foreach ($row as $colkey => $value) {
// TableNodes values doesn't need to be escaped, but maybe somebody does it.
$rows[$rowkey][$colkey] = $this->replace_slashes($value);
// Transforms vars into nasty strings.
if (preg_match('/\$NASTYSTRING(\d)/', $rows[$rowkey][$colkey])) {
$rows[$rowkey][$colkey] = $this->replace_nasty_strings($rows[$rowkey][$colkey]);
@@ -102,18 +99,6 @@ class behat_transformations extends behat_base {
return $tablenode;
}
/**
* Removes the escaped double quotes.
*
* Method reused by TableNode transformation.
*
* @param string $string
* @return string
*/
public function replace_slashes($string) {
return str_replace('\"', '"', $string);
}
/**
* Replaces $NASTYSTRING vars for a nasty string.
*