Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 9 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
syntaxCheck="false">
<testsuites>
<testsuite name="Stringy">
<file>tests/StringyTest.php</file>
<file>tests/StaticStringyTest.php</file>
<file phpVersion="5.6.0">tests/CreateTest.php</file>
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
<exclude>
<directory suffix="include.php">src</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
3 changes: 2 additions & 1 deletion tests/CreateTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use function Stringy\create as s;
use PHPUnit\Framework\TestCase;

class CreateTestCase extends PHPUnit_Framework_TestCase
class CreateTestCase extends TestCase
{
public function testCreate()
{
Expand Down
10 changes: 9 additions & 1 deletion tests/StaticStringyTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use Stringy\StaticStringy as S;
use PHPUnit\Framework\TestCase;

class StaticStringyTestCase extends PHPUnit_Framework_TestCase
class StaticStringyTestCase extends TestCase
{
/**
* @expectedException BadMethodCallException
Expand All @@ -25,6 +26,13 @@ public function testInvocation()
$this->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);
Expand Down
9 changes: 8 additions & 1 deletion tests/StringyTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

use Stringy\Stringy as S;
use PHPUnit\Framework\TestCase;

class StringyTestCase extends PHPUnit_Framework_TestCase
class StringyTestCase extends TestCase
{
/**
* Asserts that a variable is of a Stringy instance.
Expand Down Expand Up @@ -849,6 +850,12 @@ public function startsWithProvider()
];
}

public function testStartsWithAnyOnNullSubstring()
{
$stringy = S::create('foo bar', 'UTF-8');
$this->assertFalse($stringy->startsWithAny(null));
}

/**
* @dataProvider startsWithProviderAny()
*/
Expand Down