Skip to content

Commit

Permalink
Write more complex tests
Browse files Browse the repository at this point in the history
  • Loading branch information
carusogabriel committed Jan 28, 2018
1 parent a467aa5 commit a05b25b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
Test is_countable() function
--FILE--
<?php

var_dump(is_countable(new class extends ArrayIterator {}));
var_dump(is_countable((array) new stdClass()));
var_dump(is_countable(new class implements Countable {
public function count()
{
return count(1, 'foo');
}
}));


?>
--EXPECTF--
bool(true)
bool(true)
bool(true)
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Test is_countable() function
<?php

var_dump(is_countable([1, 2, 3]));
var_dump(is_countable(new ArrayIterator(['foo', 'bar', 'baz'])));
var_dump(is_countable(new ArrayIterator()));
var_dump(is_countable(new stdClass()));
var_dump(is_countable((array) 1));
var_dump(is_countable((object) ['foo', 'bar', 'baz']));


$foo = ['', []];

Expand All @@ -23,7 +23,6 @@ if (!is_countable($bar)) {
--EXPECTF--
bool(true)
bool(true)
bool(true)
bool(false)
int(2)

Expand Down

0 comments on commit a05b25b

Please sign in to comment.