예제 #1
0
 public function testOutputHTMLSpecialChars()
 {
     $html = "<html>Foobar \" <script foo='bar'>derp;</script> </html>";
     $m1 = Blueprint::make('Model1', ['str1' => $html]);
     SnakeDruid::$output_htmlspecialchars = false;
     $m1 = Model1::from_id($m1->id);
     $this->assertEquals($html, $m1->str1);
     SnakeDruid::$output_htmlspecialchars = true;
     $escaped = htmlspecialchars($html, ENT_QUOTES, 'utf-8');
     $this->assertEquals($escaped, $m1->str1);
     SnakeDruid::$output_htmlspecialchars = false;
 }
예제 #2
0
 /**
  * @depends testInsert
  */
 public function testNullIsNullWithHtmlspecialchars()
 {
     SnakeDruid::$output_htmlspecialchars = true;
     $model1 = new Model1();
     $model1->int1 = null;
     $model1->commit();
     $id = $model1->id;
     unset($model1);
     $model1 = Model1::from_id($id);
     $this->assertNull($model1->int1);
     SnakeDruid::$output_htmlspecialchars = false;
 }