Exemplo n.º 1
0
 /**
  * @covers \Magento\Framework\Escaper::escapeQuote
  */
 public function testEscapeQuote()
 {
     $data = "Text with 'single' and \"double\" quotes";
     $expected = ["Text with 'single' and "double" quotes", "Text with \\'single\\' and \\"double\\" quotes"];
     $this->assertEquals($expected[0], $this->_escaper->escapeQuote($data));
     $this->assertEquals($expected[1], $this->_escaper->escapeQuote($data, true));
 }
Exemplo n.º 2
0
 /**
  * Escape quotes inside html attributes
  *
  * Use $addSlashes = false for escaping js that inside html attribute (onClick, onSubmit etc)
  *
  * @param  string $data
  * @param  bool $addSlashes
  * @return string
  */
 public function escapeQuote($data, $addSlashes = false)
 {
     return $this->_escaper->escapeQuote($data, $addSlashes);
 }