コード例 #1
0
ファイル: FilterBehaviorTest.php プロジェクト: titon/db
 public function testXss()
 {
     $post = new Post();
     $post->addBehavior($this->object->filter('content', 'xss', ['strip' => false]));
     $post_id = $post->create(['topic_id' => 5, 'active' => 0, 'content' => 'These <iframe></iframe> <div onclick="">html</div> <i>tags</i> should <ns:b>be</ns:b> removed!']);
     $this->assertEquals(new Entity(['id' => $post_id, 'topic_id' => 5, 'active' => 0, 'deleted' => 0, 'content' => 'These  &lt;div&gt;html&lt;/div&gt; &lt;i&gt;tags&lt;/i&gt; should be removed!', 'created_at' => null, 'deleted_at' => null]), $post->read($post_id));
 }
コード例 #2
0
ファイル: ConverterBehaviorTest.php プロジェクト: titon/db
 public function testEncodeDecodeSkip()
 {
     $behavior = $this->object->convert('content', 'base64', ['encode' => false, 'decode' => false]);
     $post = new Post();
     $post->addBehavior($behavior);
     $post_id = $post->create(['topic_id' => 3, 'active' => 1, 'content' => 'This data will remain intact']);
     $this->assertEquals(new Entity(['id' => $post_id, 'topic_id' => 3, 'active' => 1, 'deleted' => 0, 'content' => 'This data will remain intact', 'created_at' => null, 'deleted_at' => null]), $post->read($post_id));
 }