/** * @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\Iterator\ComponentFilteredIterator::__construct * @covers Fabfuel\Prophiler\Iterator\ComponentFilteredIterator::accept * @covers Fabfuel\Prophiler\Iterator\ComponentFilteredIterator::count * @covers Fabfuel\Prophiler\Iterator\ComponentFilteredIterator::acceptFilters * @covers Fabfuel\Prophiler\Iterator\ComponentFilteredIterator::acceptFilter * @uses Fabfuel\Prophiler\Profiler */ public function testAcceptWithNonMathingArrayFilters() { $benchmark = $this->getMock('Fabfuel\\Prophiler\\Benchmark\\BenchmarkInterface'); $benchmark->expects($this->any())->method('getComponent')->willReturn('Foobar'); $this->profiler->addBenchmark($benchmark); $filters = ['foobars' => ['foobar1', 'foobar2']]; $iterator = new ComponentFilteredIterator($this->profiler, 'Foobar', $filters); $this->assertSame(0, $iterator->count()); }