public function testIsIterable() { $this->assertTrue(isIterable([])); $this->assertTrue(isIterable([1, 2, 3])); $this->assertTrue(isIterable(new \ArrayIterator([1, 2, 3]))); $gen = function () { yield; }; $this->assertTrue(isIterable($gen())); $this->assertFalse(isIterable(new \stdClass())); $this->assertFalse(isIterable("foobar")); $this->assertFalse(isIterable(123)); }
public function testIsIteratorNotIterable() { $a = $this->getMockBuilder('\\SR\\Exception\\Runtime\\RuntimeException')->getMockForAbstractClass(); static::assertFalse(isIterable($a)); static::assertNull(isIterableEmpty($a)); static::assertNull(isIterableNotEmpty($a)); }