/** * @covers Fabfuel\Prophiler\Profiler::current * @covers Fabfuel\Prophiler\Profiler::next * @covers Fabfuel\Prophiler\Profiler::valid * @covers Fabfuel\Prophiler\Profiler::rewind * @covers Fabfuel\Prophiler\Profiler::key * @uses Fabfuel\Prophiler\Profiler * @uses Fabfuel\Prophiler\Benchmark\Benchmark * @uses Fabfuel\Prophiler\Benchmark\BenchmarkFactory */ public function testIteration() { $benchmark1 = $this->profiler->start('Foobar'); $this->profiler->stop($benchmark1); $benchmark2 = $this->profiler->start('Loremk Ipsum'); $this->profiler->stop($benchmark2); $this->profiler->rewind(); $this->assertSame(spl_object_hash($benchmark1), $this->profiler->key()); $this->assertTrue($this->profiler->valid()); $this->assertSame($benchmark1, $this->profiler->current()); $this->profiler->next(); $this->assertSame(spl_object_hash($benchmark2), $this->profiler->key()); $this->assertTrue($this->profiler->valid()); $this->assertSame($benchmark2, $this->profiler->current()); $this->profiler->next(); $this->assertFalse($this->profiler->valid()); }