From 1f50c3be4f59487b41b45de506f9f99d091340fb Mon Sep 17 00:00:00 2001 From: peter279k Date: Wed, 29 Aug 2018 02:03:16 +0800 Subject: [PATCH] Test enhancement --- .travis.yml | 15 +++++---------- composer.json | 4 ++-- phpunit.xml.dist | 12 +++++++++--- tests/CreateTest.php | 3 ++- tests/StaticStringyTest.php | 10 +++++++++- tests/StringyTest.php | 9 ++++++++- 6 files changed, 35 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3843bdd..d36423f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,14 +10,6 @@ sudo: false matrix: fast_finish: true include: - - php: 5.4 - env: polyfill='true' - - php: 5.4 - env: polyfill='false' - - php: 5.5 - env: polyfill='true' - - php: 5.5 - env: polyfill='false' - php: 5.6 env: polyfill='true' - php: 5.6 @@ -30,8 +22,11 @@ matrix: env: polyfill='true' - php: 7.1 env: polyfill='false' - -install: travis_retry composer install --no-interaction --prefer-source + env: polyfill='false' + - php: 7.2 + env: polyfill='true' + - php: 7.2 + env: polyfill='false' before_script: - travis_retry composer self-update diff --git a/composer.json b/composer.json index 092989f..989b526 100644 --- a/composer.json +++ b/composer.json @@ -15,11 +15,11 @@ } ], "require": { - "php": ">=5.4.0", + "php": ">=5.6.0", "symfony/polyfill-mbstring": "~1.1" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^5.7 || ^6.5" }, "support": { "issues": "https://github.com/danielstjules/Stringy/issues", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index fd7d0e7..353a8cd 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,9 +6,15 @@ syntaxCheck="false"> - tests/StringyTest.php - tests/StaticStringyTest.php - tests/CreateTest.php + tests + + + src + + src + + + diff --git a/tests/CreateTest.php b/tests/CreateTest.php index 5e211cd..2649e7d 100644 --- a/tests/CreateTest.php +++ b/tests/CreateTest.php @@ -1,8 +1,9 @@ assertInternalType('string', $result); } + public function testEmptyStringToBoolean() + { + $result = S::toBoolean(''); + $this->assertFalse($result); + $this->assertInternalType('bool', $result); + } + public function testPartialArgsInvocation() { $result = S::slice('foobar', 0, 3); diff --git a/tests/StringyTest.php b/tests/StringyTest.php index 97d5502..4c17f33 100644 --- a/tests/StringyTest.php +++ b/tests/StringyTest.php @@ -1,8 +1,9 @@ assertFalse($stringy->startsWithAny(null)); + } + /** * @dataProvider startsWithProviderAny() */