From e3d9a037f6e41d08872c8c64a24c0b5257d5eae9 Mon Sep 17 00:00:00 2001 From: Jim Parry Date: Fri, 15 Mar 2019 23:32:34 -0700 Subject: [PATCH 1/6] Added tests in ContentSecurityPolicyTest --- .../system/HTTP/ContentSecurityPolicyTest.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/system/HTTP/ContentSecurityPolicyTest.php b/tests/system/HTTP/ContentSecurityPolicyTest.php index 958bfa5f45..3e93b49172 100644 --- a/tests/system/HTTP/ContentSecurityPolicyTest.php +++ b/tests/system/HTTP/ContentSecurityPolicyTest.php @@ -39,6 +39,7 @@ class ContentSecurityPolicyTest extends \CIUnitTestCase } //-------------------------------------------------------------------- + /** * @runInSeparateProcess * @preserveGlobalState disabled @@ -52,6 +53,7 @@ class ContentSecurityPolicyTest extends \CIUnitTestCase } //-------------------------------------------------------------------- + /** * @runInSeparateProcess * @preserveGlobalState disabled @@ -66,6 +68,7 @@ class ContentSecurityPolicyTest extends \CIUnitTestCase } //-------------------------------------------------------------------- + /** * @runInSeparateProcess * @preserveGlobalState disabled @@ -86,6 +89,7 @@ class ContentSecurityPolicyTest extends \CIUnitTestCase } //-------------------------------------------------------------------- + /** * @runInSeparateProcess * @preserveGlobalState disabled @@ -306,6 +310,7 @@ class ContentSecurityPolicyTest extends \CIUnitTestCase } //-------------------------------------------------------------------- + /** * @runInSeparateProcess * @preserveGlobalState disabled @@ -457,4 +462,32 @@ class ContentSecurityPolicyTest extends \CIUnitTestCase $this->assertContains('nonce-', $result); } + //-------------------------------------------------------------------- + + /** + * @runInSeparateProcess + * @preserveGlobalState disabled + */ + public function testHeaderWrongCaseNotFound() + { + $this->prepare(); + $result = $this->work(); + + $result = $this->getHeaderEmitted('content-security-policy'); + $this->assertNull($result); + } + + /** + * @runInSeparateProcess + * @preserveGlobalState disabled + */ + public function testHeaderIgnoreCase() + { + $this->prepare(); + $result = $this->work(); + + $result = $this->getHeaderEmitted('content-security-policy', true); + $this->assertContains("base-uri 'self';", $result); + } + } From 14e1451aa949d67f3d68cdbbcafce11cd97e8c0a Mon Sep 17 00:00:00 2001 From: Jim Parry Date: Sun, 17 Mar 2019 00:37:29 -0700 Subject: [PATCH 2/6] Fix & test Test\DOMParser --- system/Test/DOMParser.php | 9 +++-- tests/system/Test/DOMParserTest.php | 53 +++++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/system/Test/DOMParser.php b/system/Test/DOMParser.php index 55bd10eff9..41dfacd19a 100644 --- a/system/Test/DOMParser.php +++ b/system/Test/DOMParser.php @@ -47,7 +47,10 @@ class DOMParser { if (! extension_loaded('DOM')) { + // always there in travis-ci + // @codeCoverageIgnoreStart throw new \BadMethodCallException('DOM extension is required, but not currently loaded.'); + // @codeCoverageIgnoreEnd } $this->dom = new \DOMDocument('1.0', 'utf-8'); @@ -78,8 +81,10 @@ class DOMParser //turning off some errors libxml_use_internal_errors(true); - if (! $this->dom->loadHTML($content)) + $this->dom->loadHTML($content); + if (sizeof(libxml_get_errors()) > 0) { + libxml_clear_errors(); throw new \BadMethodCallException('Invalid HTML'); } @@ -248,7 +253,7 @@ class DOMParser { foreach ($selector['attr'] as $key => $value) { - $path .= "[{$key}={$value}]"; + $path .= "[@{$key}=\"{$value}\"]"; } } diff --git a/tests/system/Test/DOMParserTest.php b/tests/system/Test/DOMParserTest.php index 8bd9b1479b..93ea627533 100644 --- a/tests/system/Test/DOMParserTest.php +++ b/tests/system/Test/DOMParserTest.php @@ -1,7 +1,9 @@ -

Hello

'; $expected = '' . "\n" - . '

Hello

'; + . '

Hello

'; $this->assertEquals($expected . "\n", $dom->withString($html)->getBody()); } @@ -74,6 +76,16 @@ class DOMParserTest extends CIUnitTestCase $this->assertTrue($dom->see('Hello World')); } + public function testBadHTML() + { + $dom = new DOMParser(); + + $html = '

Hello World

'; + + $this->expectException(\BadMethodCallException::class); + $dom->withString($html); + } + public function testSeeHTML() { $dom = new DOMParser(); @@ -333,4 +345,41 @@ class DOMParserTest extends CIUnitTestCase $this->assertTrue($dom->seeCheckboxIsChecked('.btn')); } + + public function testWithFile() + { + $dom = new DOMParser(); + + $filename = APPPATH . 'index.html'; + + $dom->withFile($filename); + $this->assertTrue($dom->see('Directory access is forbidden.')); + } + + public function testWithNotFile() + { + $dom = new DOMParser(); + + $filename = APPPATH . 'bogus.html'; + + $this->expectException(\InvalidArgumentException::class); + $dom->withFile($filename); + } + + public function testSeeAttribute() + { + $dom = new DOMParser(); + + $path = '[ name = user ]'; + $selector = $dom->parseSelector($path); + + $this->assertEquals(['name' => 'user'], $selector['attr']); + + $html = '
George
'; + $dom->withString($html); + + $this->assertTrue($dom->see(null, '*[ name = user ]')); + $this->assertFalse($dom->see(null, '*[ name = notthere ]')); + } + } From bff20d2b8fcd7808c12abb173a0049218665a2b8 Mon Sep 17 00:00:00 2001 From: Jim Parry Date: Sun, 17 Mar 2019 00:45:26 -0700 Subject: [PATCH 3/6] Fix & test Test\DOMParser --- tests/system/Test/ControllerTesterTest.php | 109 +++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 tests/system/Test/ControllerTesterTest.php diff --git a/tests/system/Test/ControllerTesterTest.php b/tests/system/Test/ControllerTesterTest.php new file mode 100644 index 0000000000..b7748ef6c3 --- /dev/null +++ b/tests/system/Test/ControllerTesterTest.php @@ -0,0 +1,109 @@ + 0) + // { + // ob_end_clean(); + // } + // } + // + public function testGetPrivatePropertyWithObject() + { + $obj = new __TestForReflectionHelper(); + $actual = $this->getPrivateProperty($obj, 'private'); + $this->assertEquals('secret', $actual); + } + + //-------------------------------------------------------------------- + + public function testLogging() + { + log_message('error', 'Some variable did not contain a value.'); + $this->assertLogged('error', 'Some variable did not contain a value.'); + } + + //-------------------------------------------------------------------- + + public function testEventTriggering() + { + Events::on('foo', function ($arg) use (&$result) { + $result = $arg; + }); + + Events::trigger('foo', 'bar'); + + $this->assertEventTriggered('foo'); + } + + //-------------------------------------------------------------------- + + public function testStreamFilter() + { + CITestStreamFilter::$buffer = ''; + $this->stream_filter = stream_filter_append(STDOUT, 'CITestStreamFilter'); + \CodeIgniter\CLI\CLI::write('first.'); + $expected = "first.\n"; + $this->assertEquals($expected, CITestStreamFilter::$buffer); + stream_filter_remove($this->stream_filter); + } + + //-------------------------------------------------------------------- + /** + * PHPunit emits headers before we get nominal control of + * the output stream, making header testing awkward, to say + * the least. This test is intended to make sure that this + * is happening as expected. + * + * TestCaseEmissionsTest is intended to circumvent PHPunit, + * and allow us to test our own header emissions. + */ + public function testPHPUnitHeadersEmitted() + { + $response = new Response(new App()); + $response->pretend(true); + + $body = 'Hello'; + $response->setBody($body); + + ob_start(); + $response->send(); + ob_end_clean(); + + // Did PHPunit do its thing? + $this->assertHeaderEmitted('Content-type: text/html;'); + $this->assertHeaderNotEmitted('Set-Cookie: foo=bar;'); + } + + //-------------------------------------------------------------------- + public function testCloseEnough() + { + $this->assertCloseEnough(1, 1); + $this->assertCloseEnough(1, 0); + $this->assertCloseEnough(1, 2); + } + + public function testCloseEnoughString() + { + $this->assertCloseEnoughString(strtotime('10:00:00'), strtotime('09:59:59')); + $this->assertCloseEnoughString(strtotime('10:00:00'), strtotime('10:00:00')); + $this->assertCloseEnoughString(strtotime('10:00:00'), strtotime('10:00:01')); + } + + public function testCloseEnoughStringBadLength() + { + $result = $this->assertCloseEnoughString('apples & oranges', 'apples'); + $this->assertFalse($result, 'Different string lengths should have returned false'); + } + +} From 39657d331050ad567be4472f13db5cdd45e38705 Mon Sep 17 00:00:00 2001 From: Jim Parry Date: Mon, 18 Mar 2019 08:45:35 -0700 Subject: [PATCH 4/6] Fix ControllerTester to capture returned view --- system/Test/ControllerResponse.php | 9 +- system/Test/ControllerTester.php | 42 +++++-- system/Test/DOMParser.php | 3 +- tests/system/Test/ControllerTesterTest.php | 117 +++++------------- user_guide_src/source/testing/controllers.rst | 14 +++ 5 files changed, 86 insertions(+), 99 deletions(-) diff --git a/system/Test/ControllerResponse.php b/system/Test/ControllerResponse.php index 393fb879c0..3565ef6c57 100644 --- a/system/Test/ControllerResponse.php +++ b/system/Test/ControllerResponse.php @@ -143,7 +143,7 @@ class ControllerResponse { //-------------------------------------------------------------------- /** - * Boils down the possible responses into a bolean valid/not-valid + * Boils down the possible responses into a boolean valid/not-valid * response type. * * @return boolean @@ -180,6 +180,13 @@ class ControllerResponse { // Utility //-------------------------------------------------------------------- + /** + * Forward any unrecognized method calls to our DOMParser instance. + * + * @param string $function Method name + * @param mixed $params Any method parameters + * @return mixed + */ public function __call($function, $params) { if (method_exists($this->dom, $function)) diff --git a/system/Test/ControllerTester.php b/system/Test/ControllerTester.php index e4de016ed5..333a92a589 100644 --- a/system/Test/ControllerTester.php +++ b/system/Test/ControllerTester.php @@ -1,4 +1,5 @@ -response = new Response($this->appConfig); } - $this->controller = new $name($this->request, $this->response); + if (empty($this->logger)) + { + $this->logger = new \CodeIgniter\Log\Handlers\FileHandler(); + } + + $this->controller = new $name(); + $this->controller->initController($this->request, $this->response, $this->logger); return $this; } @@ -124,8 +128,8 @@ trait ControllerTester helper('url'); $result = (new ControllerResponse()) - ->setRequest($this->request) - ->setResponse($this->response); + ->setRequest($this->request) + ->setResponse($this->response); try { @@ -136,7 +140,7 @@ trait ControllerTester catch (\Throwable $e) { $result->response() - ->setStatusCode($e->getCode()); + ->setStatusCode($e->getCode()); } finally { @@ -149,6 +153,12 @@ trait ControllerTester $result->setResponse($response); } + // check if controller returned a view rather than echoing it + if (is_string($response)) + { + $output = $response; + } + $result->response()->setBody($output); $result->setBody($output); } @@ -198,6 +208,18 @@ trait ControllerTester return $this; } + /** + * @param mixed $logger + * + * @return mixed + */ + public function withLogger($logger) + { + $this->logger = $logger; + + return $this; + } + /** * @param string $uri * diff --git a/system/Test/DOMParser.php b/system/Test/DOMParser.php index 41dfacd19a..67f72bd127 100644 --- a/system/Test/DOMParser.php +++ b/system/Test/DOMParser.php @@ -81,8 +81,7 @@ class DOMParser //turning off some errors libxml_use_internal_errors(true); - $this->dom->loadHTML($content); - if (sizeof(libxml_get_errors()) > 0) + if (! $this->dom->loadHTML($content)) { libxml_clear_errors(); throw new \BadMethodCallException('Invalid HTML'); diff --git a/tests/system/Test/ControllerTesterTest.php b/tests/system/Test/ControllerTesterTest.php index b7748ef6c3..cccdd7ab53 100644 --- a/tests/system/Test/ControllerTesterTest.php +++ b/tests/system/Test/ControllerTesterTest.php @@ -1,109 +1,54 @@ 0) - // { - // ob_end_clean(); - // } - // } - // - public function testGetPrivatePropertyWithObject() + use ControllerTester; + + public function setUp() { - $obj = new __TestForReflectionHelper(); - $actual = $this->getPrivateProperty($obj, 'private'); - $this->assertEquals('secret', $actual); + parent::setUp(); } - //-------------------------------------------------------------------- - - public function testLogging() + public function tearDown() { - log_message('error', 'Some variable did not contain a value.'); - $this->assertLogged('error', 'Some variable did not contain a value.'); + parent::tearDown(); } - //-------------------------------------------------------------------- - - public function testEventTriggering() + public function testBadController() { - Events::on('foo', function ($arg) use (&$result) { - $result = $arg; - }); - - Events::trigger('foo', 'bar'); - - $this->assertEventTriggered('foo'); + $this->expectException(\InvalidArgumentException::class); + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\App\Controllers\NeverHeardOfIt::class) + ->execute('index'); } - //-------------------------------------------------------------------- - - public function testStreamFilter() + public function testBadControllerMethod() { - CITestStreamFilter::$buffer = ''; - $this->stream_filter = stream_filter_append(STDOUT, 'CITestStreamFilter'); - \CodeIgniter\CLI\CLI::write('first.'); - $expected = "first.\n"; - $this->assertEquals($expected, CITestStreamFilter::$buffer); - stream_filter_remove($this->stream_filter); + $this->expectException(\InvalidArgumentException::class); + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\App\Controllers\Home::class) + ->execute('nothere'); } - //-------------------------------------------------------------------- - /** - * PHPunit emits headers before we get nominal control of - * the output stream, making header testing awkward, to say - * the least. This test is intended to make sure that this - * is happening as expected. - * - * TestCaseEmissionsTest is intended to circumvent PHPunit, - * and allow us to test our own header emissions. - */ - public function testPHPUnitHeadersEmitted() + public function testController() { - $response = new Response(new App()); - $response->pretend(true); + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\App\Controllers\Home::class) + ->execute('index'); - $body = 'Hello'; - $response->setBody($body); - - ob_start(); - $response->send(); - ob_end_clean(); - - // Did PHPunit do its thing? - $this->assertHeaderEmitted('Content-type: text/html;'); - $this->assertHeaderNotEmitted('Set-Cookie: foo=bar;'); - } - - //-------------------------------------------------------------------- - public function testCloseEnough() - { - $this->assertCloseEnough(1, 1); - $this->assertCloseEnough(1, 0); - $this->assertCloseEnough(1, 2); - } - - public function testCloseEnoughString() - { - $this->assertCloseEnoughString(strtotime('10:00:00'), strtotime('09:59:59')); - $this->assertCloseEnoughString(strtotime('10:00:00'), strtotime('10:00:00')); - $this->assertCloseEnoughString(strtotime('10:00:00'), strtotime('10:00:01')); - } - - public function testCloseEnoughStringBadLength() - { - $result = $this->assertCloseEnoughString('apples & oranges', 'apples'); - $this->assertFalse($result, 'Different string lengths should have returned false'); + $body = $result->getBody(); + $this->assertTrue($result->isOK()); } } diff --git a/user_guide_src/source/testing/controllers.rst b/user_guide_src/source/testing/controllers.rst index 21615673d1..cd37c777d7 100644 --- a/user_guide_src/source/testing/controllers.rst +++ b/user_guide_src/source/testing/controllers.rst @@ -108,6 +108,20 @@ Allows you to provide a **Response** instance:: If you do not provide one, a new Response instance with the default application values will be passed into your controller. +**withLogger($logger)** + +Allows you to provide a **Logger** instance:: + + $logger = new CodeIgniter\Log\Handlers\FileHandler(); + + $results = $this->withResponse($response) + -> withLogger($logger) + ->controller(\App\Controllers\ForumController::class) + ->execute('showCategories'); + +If you do not provide one, a new Logger instance with the default configuration values will be passed +into your controller. + **withURI($uri)** Allows you to provide a new URI that simulates the URL the client was visiting when this controller was run. From 10ce36ba2aa654a108904aaf7dab3edf2a68bd21 Mon Sep 17 00:00:00 2001 From: Jim Parry Date: Wed, 20 Mar 2019 10:39:20 -0700 Subject: [PATCH 5/6] Fix & test ControllerTester --- system/Test/ControllerTester.php | 7 +- system/Test/DOMParser.php | 3 + tests/_support/Controllers/Popcorn.php | 46 +++++++ tests/system/Test/ControllerTesterTest.php | 149 +++++++++++++++++++++ 4 files changed, 202 insertions(+), 3 deletions(-) create mode 100644 tests/_support/Controllers/Popcorn.php diff --git a/system/Test/ControllerTester.php b/system/Test/ControllerTester.php index 333a92a589..1016d13036 100644 --- a/system/Test/ControllerTester.php +++ b/system/Test/ControllerTester.php @@ -42,6 +42,7 @@ use CodeIgniter\HTTP\UserAgent; use CodeIgniter\HTTP\Response; use CodeIgniter\HTTP\URI; use Config\App; +use Config\Services; /** * ControllerTester Trait @@ -99,7 +100,7 @@ trait ControllerTester if (empty($this->logger)) { - $this->logger = new \CodeIgniter\Log\Handlers\FileHandler(); + $this->logger = Services::logger(); } $this->controller = new $name(); @@ -131,6 +132,7 @@ trait ControllerTester ->setRequest($this->request) ->setResponse($this->response); + $response = null; try { ob_start(); @@ -146,8 +148,7 @@ trait ControllerTester { $output = ob_get_clean(); - // If the controller returned a redirect response - // then we need to use that... + // If the controller returned a response, use it if (isset($response) && $response instanceof Response) { $result->setResponse($response); diff --git a/system/Test/DOMParser.php b/system/Test/DOMParser.php index 67f72bd127..57af92f60c 100644 --- a/system/Test/DOMParser.php +++ b/system/Test/DOMParser.php @@ -83,8 +83,11 @@ class DOMParser if (! $this->dom->loadHTML($content)) { + // unclear how we would get here, given that we are trapping libxml errors + // @codeCoverageIgnoreStart libxml_clear_errors(); throw new \BadMethodCallException('Invalid HTML'); + // @codeCoverageIgnoreEnd } // ignore the whitespace. diff --git a/tests/_support/Controllers/Popcorn.php b/tests/_support/Controllers/Popcorn.php new file mode 100644 index 0000000000..7cc3a79665 --- /dev/null +++ b/tests/_support/Controllers/Popcorn.php @@ -0,0 +1,46 @@ +respond('Oops', 567, 'Surprise'); + } + + public function popper() + { + throw new \RuntimeException('Surprise', 500); + } + + public function weasel() + { + $this->respond(['Nothing to see here'], 200); + } + + public function oops() + { + $this->failUnauthorized(); + } + + public function goaway() + { + return redirect()->to('/'); + } +} diff --git a/tests/system/Test/ControllerTesterTest.php b/tests/system/Test/ControllerTesterTest.php index cccdd7ab53..220bcf2c5c 100644 --- a/tests/system/Test/ControllerTesterTest.php +++ b/tests/system/Test/ControllerTesterTest.php @@ -2,6 +2,8 @@ namespace CodeIgniter\Test; use CodeIgniter\Log\Logger; +use Config\App; +use Config\Services; use Tests\Support\Config\MockLogger as LoggerConfig; class ControllerTesterTest extends \CIUnitTestCase @@ -51,4 +53,151 @@ class ControllerTesterTest extends \CIUnitTestCase $this->assertTrue($result->isOK()); } + public function testControllerWithoutLogger() + { + $result = $this->withURI('http://example.com') + ->controller(\App\Controllers\Home::class) + ->execute('index'); + + $body = $result->getBody(); + $this->assertTrue($result->isOK()); + } + + public function testPopcornIndex() + { + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\Tests\Support\Controllers\Popcorn::class) + ->execute('index'); + + $body = $result->getBody(); + $this->assertTrue($result->isOK()); + } + + public function testPopcornIndex2() + { + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\Tests\Support\Controllers\Popcorn::class) + ->execute('index'); + + $body = $result->getBody(); + $this->assertEquals('Hi there', $body); + } + + public function testPopcornFailure() + { + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\Tests\Support\Controllers\Popcorn::class) + ->execute('pop'); + + $body = $result->getBody(); + $this->assertEquals(567, $result->response()->getStatusCode()); + } + + public function testPopcornException() + { + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\Tests\Support\Controllers\Popcorn::class) + ->execute('popper'); + + $body = $result->getBody(); + $this->assertEquals(500, $result->response()->getStatusCode()); + } + + public function testPopcornIndexWithSupport() + { + $logger = new Logger(new LoggerConfig()); + $config = new App(); + $body = ''; + + $result = $this->withURI('http://example.com') + ->withConfig($config) + ->withRequest(Services::request($config)) + ->withResponse(Services::response($config)) + ->withLogger($logger) + ->withBody($body) + ->controller(\Tests\Support\Controllers\Popcorn::class) + ->execute('index'); + + $body = $result->getBody(); + $this->assertEquals('Hi there', $body); + } + + public function testRequestPassthrough() + { + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\Tests\Support\Controllers\Popcorn::class) + ->execute('popper'); + + $req = $result->request(); + $this->assertEquals('get', $req->getMethod()); + } + + public function testFailureResponse() + { + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\Tests\Support\Controllers\Popcorn::class) + ->execute('oops'); + + $this->assertFalse($result->isOK()); + $this->assertEquals(401, $result->response()->getStatusCode()); + } + + public function testEmptyResponse() + { + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\Tests\Support\Controllers\Popcorn::class) + ->execute('weasel'); + + $body = $result->getBody(); // empty + $this->assertFalse($result->isOK()); + } + + public function testRedirect() + { + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\Tests\Support\Controllers\Popcorn::class) + ->execute('goaway'); + + $this->assertTrue($result->isRedirect()); + } + + public function testDOMParserForward() + { + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\Tests\Support\Controllers\Popcorn::class) + ->execute('index'); + + $this->assertTrue($result->see('Hi')); + } + + public function testFailsForward() + { + $logger = new Logger(new LoggerConfig()); + $result = $this->withURI('http://example.com') + ->withLogger($logger) + ->controller(\Tests\Support\Controllers\Popcorn::class) + ->execute('index'); + + // won't fail, but doesn't do anything + $this->assertNull($result->ohno('Hi')); + } + } From 0b8c193616f4b7a53376e47f116348fd49ed02f2 Mon Sep 17 00:00:00 2001 From: Jim Parry Date: Wed, 20 Mar 2019 11:38:43 -0700 Subject: [PATCH 6/6] Drop DOMParserTest::badHTML test --- tests/system/Test/DOMParserTest.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/system/Test/DOMParserTest.php b/tests/system/Test/DOMParserTest.php index 93ea627533..ccd34261fb 100644 --- a/tests/system/Test/DOMParserTest.php +++ b/tests/system/Test/DOMParserTest.php @@ -76,16 +76,6 @@ class DOMParserTest extends CIUnitTestCase $this->assertTrue($dom->see('Hello World')); } - public function testBadHTML() - { - $dom = new DOMParser(); - - $html = '

Hello World

'; - - $this->expectException(\BadMethodCallException::class); - $dom->withString($html); - } - public function testSeeHTML() { $dom = new DOMParser();