Ejemplo n.º 1
0
 public function testSimple()
 {
     $pattern = ['id' => 0, 'value' => ''];
     $data = [['id' => 11, 'value' => 'foo'], ['id' => '1', 'value' => 'bar'], ['id' => 13, 'value' => false], ['id' => 13, 'value' => ['id' => 0, 'value' => 'foo']], ['id' => 7, 'value' => 'bar']];
     $matching = new Pattern();
     $matching->match($pattern, $data);
     $this->assertEquals($matching->current(), ['id' => 11, 'value' => 'foo']);
     $matching->next();
     $this->assertEquals($matching->current(), ['id' => 7, 'value' => 'bar']);
     $this->assertEquals(2, iterator_count($matching));
 }