コード例 #1
0
 public function testIteratorWithMessages()
 {
     $data = ['One', 'Two', 'Three'];
     $this->sessionStub->set('messages', [10 => $data]);
     $this->container->rewind();
     $this->assertTrue($this->container->valid());
     $this->assertSame('One', $this->container->current());
     $this->assertSame(0, $this->container->key());
     $this->container->next();
     $this->assertTrue($this->container->valid());
     $this->assertSame('Two', $this->container->current());
     $this->assertSame(1, $this->container->key());
     $this->container->next();
     $this->assertTrue($this->container->valid());
     $this->assertSame('Three', $this->container->current());
     $this->assertSame(2, $this->container->key());
     $this->container->next();
     $this->assertFalse($this->container->valid());
 }