From 222a915334b58b7521170de2bfd296c20552fdc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Thu, 8 Nov 2018 12:43:17 +0100 Subject: [PATCH] Adding failing test case --- generator/tests/GeneratedFilesTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/generator/tests/GeneratedFilesTest.php b/generator/tests/GeneratedFilesTest.php index 696bc891..94bb3b6f 100644 --- a/generator/tests/GeneratedFilesTest.php +++ b/generator/tests/GeneratedFilesTest.php @@ -73,4 +73,19 @@ public function testObjects() $xmlElem = simplexml_import_dom($doc); $this->assertInstanceOf(SimpleXMLElement::class, $xmlElem); } + + /** + * Tests that the limit parameter is nullable. + * See https://github.com/thecodingmachine/safe/issues/56 + */ + public function testPregSplit() + { + require_once __DIR__.'/../../generated/pcre.php'; + require_once __DIR__.'/../../lib/Exceptions/SafeExceptionInterface.php'; + require_once __DIR__.'/../../lib/Exceptions/AbstractSafeException.php'; + require_once __DIR__.'/../../generated/Exceptions/PcreException.php'; + + $keywords = preg_split("/[\s,]+/", "hypertext language, programming", null); + $this->assertSame(['hypertext', 'language', 'programming'], $keywords); + } }