function testToArray() { $stack = new LinkedStack(); for ($i = 0; $i < 3; $i++) { $stack->push($i); } $array = $stack->toArray(); $this->assertTrue(is_array($array)); $this->assertCount(3, $array); $i = 2; foreach ($array as $item) { $this->assertEquals($i--, $item); } }