array(array( 'type' => 'quote', 'data' => array( 'text' => 'Text', 'cite' => 'Cite' ) )) )); $html = $converter->toHtml($json); $this->assertEquals( $html, "

Text

\n

Cite

\n
" ); // Lets convert a normal text type that uses the default converter $json = json_encode(array( 'data' => array(array( 'type' => 'text', 'data' => array( 'text' => 'test' ) )) )); $html = $converter->toHtml($json); $this->assertEquals($html, "

test

\n"); // the video conversion $json = json_encode(array( 'data' => array(array( 'type' => 'video', 'data' => array( 'source' => 'youtube', 'remote_id' => '4BXpi7056RM' ) )) )); $html = $converter->toHtml($json); $this->assertEquals( $html, "\n" ); // The heading $json = json_encode(array( 'data' => array(array( 'type' => 'heading', 'data' => array( 'text' => 'test' ) )) )); $html = $converter->toHtml($json); $this->assertEquals($html, "

test

\n"); // images $json = json_encode(array( 'data' => array(array( 'type' => 'image', 'data' => array( 'file' => array( 'url' => '/frontend/files/sir-trevor/images/IMG_3867.JPG' ) ) )) )); $html = $converter->toHtml($json); $this->assertEquals($html, "\n"); } public function testToJson() { $converter = new Converter(); $this->assertEquals( $converter->toJson('

Test

'), '{"data":[{"type":"heading","data":{"text":" Test"}}]}' ); // a quote $this->assertEquals( $converter->toJson('

Text

Cite
'), '{"data":[{"type":"quote","data":{"text":" Text","cite":" Cite"}}]}' ); $this->assertEquals( $converter->toJson('

Text

'), '{"data":[{"type":"quote","data":{"text":" Text","cite":""}}]}' ); $this->assertEquals( $converter->toJson(''), '{"data":[{"type":"image","data":{"file":{"url":"\/path\/to\/img.jpg"}}}]}' ); } }