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 <div>html</div> <i>tags</i> should be removed!', 'created_at' => null, 'deleted_at' => null]), $post->read($post_id)); }
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)); }