/**
  * @covers Fabfuel\Prophiler\Iterator\ComponentFilteredIterator::__construct
  * @covers Fabfuel\Prophiler\Iterator\ComponentFilteredIterator::accept
  * @uses Fabfuel\Prophiler\Profiler
  */
 public function testAccept()
 {
     $benchmark = $this->getMockBuilder('Fabfuel\\Prophiler\\Benchmark\\Benchmark')->disableOriginalConstructor()->getMock();
     $benchmark->expects($this->exactly(2))->method('getComponent')->willReturn('Foobar');
     $this->profiler->addBenchmark($benchmark);
     $iterator = new ComponentFilteredIterator($this->profiler, 'Foobar');
     $iterator->rewind();
     $this->assertTrue($iterator->accept());
 }
 /**
  * @covers Fabfuel\Prophiler\Profiler::__construct
  * @covers Fabfuel\Prophiler\Profiler::count
  * @covers Fabfuel\Prophiler\Profiler::addBenchmark
  * @covers Fabfuel\Prophiler\Profiler::getBenchmarks
  * @uses   Fabfuel\Prophiler\Benchmark\BenchmarkFactory
  * @uses   Fabfuel\Prophiler\Benchmark\Benchmark
  */
 public function testAddAndCountBenchmarks()
 {
     $benchmark1 = BenchmarkFactory::getBenchmark('fooabar');
     $benchmark2 = BenchmarkFactory::getBenchmark('lorem');
     $benchmark3 = BenchmarkFactory::getBenchmark('ipsum');
     $profiler = $this->profiler->addBenchmark($benchmark1)->addBenchmark($benchmark2)->addBenchmark($benchmark3);
     $this->assertSame($profiler, $this->profiler);
     $this->assertSame(3, $this->profiler->count());
     $benchmarks = $this->profiler->getBenchmarks();
     $this->assertTrue(isset($benchmarks[spl_object_hash($benchmark1)]));
     $this->assertTrue(isset($benchmarks[spl_object_hash($benchmark2)]));
     $this->assertTrue(isset($benchmarks[spl_object_hash($benchmark3)]));
 }
 /**
  * @covers Fabfuel\Prophiler\Iterator\ComponentFilteredIterator::count
  * @uses Fabfuel\Prophiler\Iterator\ComponentFilteredIterator
  * @uses Fabfuel\Prophiler\Profiler
  */
 public function testCount()
 {
     $benchmark = $this->getMock('Fabfuel\\Prophiler\\Benchmark\\BenchmarkInterface');
     $benchmark->expects($this->any())->method('getComponent')->willReturn('Foobar');
     $iterator = new ComponentFilteredIterator($this->profiler, 'Foobar');
     $this->assertSame(0, count($iterator));
     $this->profiler->addBenchmark($benchmark);
     $this->assertSame(1, count($iterator));
 }