From 580a9ca5248aacb88a37820f50deb2cb0bdc301f Mon Sep 17 00:00:00 2001 From: ajouve Date: Thu, 14 Jul 2016 14:29:36 +0100 Subject: [PATCH] getHtml --- src/Html2Text.php | 10 ++++++++++ test/BasicTest.php | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Html2Text.php b/src/Html2Text.php index 0ed5e40..5ba429e 100644 --- a/src/Html2Text.php +++ b/src/Html2Text.php @@ -243,6 +243,16 @@ public function __construct($html = '', $options = array()) : ENT_COMPAT | ENT_HTML5; } + /** + * Get the source HTML + * + * @return string + */ + public function getHtml() + { + return $this->html; + } + /** * Set the source HTML * diff --git a/test/BasicTest.php b/test/BasicTest.php index afb40d0..19c5d18 100644 --- a/test/BasicTest.php +++ b/test/BasicTest.php @@ -78,7 +78,8 @@ public function basicDataProvider() { */ public function testBasic($html, $expected) { - $html = new Html2Text($html); - $this->assertEquals($expected, $html->getText()); + $html2Text = new Html2Text($html); + $this->assertEquals($expected, $html2Text->getText()); + $this->assertEquals($html, $html2Text->getHtml()); } }