Skip to content

Commit 9a352b3

Browse files
committed
Drop useless tests as we have types now
1 parent 77ad64b commit 9a352b3

File tree

1 file changed

+0
-55
lines changed

1 file changed

+0
-55
lines changed

tests/IterableToArrayTest.php

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -33,59 +33,4 @@ public function testArrayWithoutKeysToArray()
3333
$array = array(1 => 'foo', 2 => 'bar');
3434
$this->assertEquals(array(0 => 'foo', 1 => 'bar'), iterable_to_array($array, false));
3535
}
36-
37-
public function testScalarToArray()
38-
{
39-
$scalar = 'foobar';
40-
$this->assertTrue($this->triggersError($scalar));
41-
}
42-
43-
public function testObjectToArray()
44-
{
45-
$object = new stdClass();
46-
$this->assertTrue($this->triggersError($object));
47-
}
48-
49-
public function testResourceToArray()
50-
{
51-
$resource = fopen('php://temp', 'rb');
52-
$this->assertTrue($this->triggersError($resource));
53-
}
54-
55-
private function triggersError($input)
56-
{
57-
return version_compare(PHP_VERSION, '7.0.0') >= 0 ? $this->triggersErrorPHP7($input) : $this->triggersErrorPHP5($input);
58-
}
59-
60-
private function triggersErrorPHP7($input)
61-
{
62-
$errorOccured = false;
63-
64-
try {
65-
iterable_to_array($input);
66-
}
67-
catch (\TypeError $e) {
68-
$errorOccured = true;
69-
}
70-
71-
return $errorOccured;
72-
}
73-
74-
private function triggersErrorPHP5($input)
75-
{
76-
$errorOccured = false;
77-
78-
set_error_handler(function ($errno) {
79-
return E_RECOVERABLE_ERROR === $errno;
80-
});
81-
82-
if (false === @iterable_to_array($input)) {
83-
$errorOccured = true;
84-
}
85-
86-
restore_error_handler();
87-
88-
return $errorOccured;
89-
}
90-
9136
}

0 commit comments

Comments
 (0)