From 3d26005b68858a7dec018ae17f3d2d4d1cecc560 Mon Sep 17 00:00:00 2001 From: Marek Gach Date: Wed, 11 Mar 2020 17:38:46 +0100 Subject: [PATCH] Fix tests and coverage --- tests/ChatGeneratorTest.php | 24 +++++++++++------------- tests/chat_code.txt | 8 ++++---- tests/chat_code_async.txt | 14 ++++++++++++++ tests/chat_code_simple.txt | 11 +++++++++++ 4 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 tests/chat_code_async.txt create mode 100644 tests/chat_code_simple.txt diff --git a/tests/ChatGeneratorTest.php b/tests/ChatGeneratorTest.php index 35f95af..f15fd71 100644 --- a/tests/ChatGeneratorTest.php +++ b/tests/ChatGeneratorTest.php @@ -192,19 +192,7 @@ public function test_render_simple() $this->chat->setKey('XYZ123456'); $ret = $this->chat->render(); - $expected = ""; - - $this->assertEquals($expected, $ret); + $this->assertEquals(file_get_contents(dirname(__FILE__) . '/chat_code_simple.txt'), $ret); } public function test_render_simpleOutput() @@ -216,6 +204,16 @@ public function test_render_simpleOutput() $this->expectOutputRegex('/.*window.smartsupp.*/'); } + public function test_render_async() + { + $this->chat->setKey('XYZ123456'); + $this->chat->setAsync(); + $this->chat->setAsyncDelay(2500); + $ret = $this->chat->render(); + + $this->assertEquals(file_get_contents(dirname(__FILE__) . '/chat_code_async.txt'), $ret); + } + public function test_render_allParams() { $this->chat->setKey('XYZ123456'); diff --git a/tests/chat_code.txt b/tests/chat_code.txt index 8cbe2ef..a595a46 100644 --- a/tests/chat_code.txt +++ b/tests/chat_code.txt @@ -1,6 +1,6 @@ \ No newline at end of file + \ No newline at end of file diff --git a/tests/chat_code_async.txt b/tests/chat_code_async.txt new file mode 100644 index 0000000..bae92ac --- /dev/null +++ b/tests/chat_code_async.txt @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/tests/chat_code_simple.txt b/tests/chat_code_simple.txt new file mode 100644 index 0000000..8f720cd --- /dev/null +++ b/tests/chat_code_simple.txt @@ -0,0 +1,11 @@ + \ No newline at end of file