Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Test updates for #69
Browse files Browse the repository at this point in the history
- Add names for each item in data providers.
- Import all classes used.
  • Loading branch information
weierophinney committed Dec 12, 2018
1 parent 20bede6 commit d5761e6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
19 changes: 10 additions & 9 deletions test/StringPrefixTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace ZendTest\Filter;

use PHPUnit\Framework\TestCase;
use stdClass;
use Zend\Filter\Exception\InvalidArgumentException;
use Zend\Filter\StringPrefix as StringPrefixFilter;

Expand Down Expand Up @@ -56,17 +57,17 @@ public function testWithoutPrefix()
public function invalidPrefixesDataProvider()
{
return [
[1],
[1.00],
[true],
[null],
[[]],
[fopen('php://memory', 'rb+')],
[
'int' => [1],
'float' => [1.00],
'true' => [true],
'null' => [null],
'empty array' => [[]],
'resource' => [fopen('php://memory', 'rb+')],
'array with callable' => [
function () {
},
],
[new \stdClass()],
'object' => [new stdClass()],
];
}

Expand All @@ -93,6 +94,6 @@ public function testNonScalarInput()
$prefix = 'ABC123';
$filter->setPrefix($prefix);

$this->assertInstanceOf(\stdClass::class, $filter(new \stdClass()));
$this->assertInstanceOf(stdClass::class, $filter(new stdClass()));
}
}
19 changes: 10 additions & 9 deletions test/StringSuffixTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace ZendTest\Filter;

use PHPUnit\Framework\TestCase;
use stdClass;
use Zend\Filter\Exception\InvalidArgumentException;
use Zend\Filter\StringSuffix as StringSuffixFilter;

Expand Down Expand Up @@ -56,17 +57,17 @@ public function testWithoutSuffix()
public function invalidSuffixesDataProvider()
{
return [
[1],
[1.00],
[true],
[null],
[[]],
[fopen('php://memory', 'rb+')],
[
'int' => [1],
'float' => [1.00],
'true' => [true],
'null' => [null],
'empty array' => [[]],
'resource' => [fopen('php://memory', 'rb+')],
'array with callable' => [
function () {
},
],
[new \stdClass()],
'object' => [new stdClass()],
];
}

Expand All @@ -93,6 +94,6 @@ public function testNonScalarInput()
$suffix = 'ABC123';
$filter->setSuffix($suffix);

$this->assertInstanceOf(\stdClass::class, $filter(new \stdClass()));
$this->assertInstanceOf(stdClass::class, $filter(new stdClass()));
}
}

0 comments on commit d5761e6

Please sign in to comment.