<?php
namespace nur\mapper\item;

use nur\t\TestCase;

class ItemFilterMapperTest extends TestCase {
  const SOURCE = [1, 2, 3, 4, 5];
  function testSkipItems() {
    $filter = new ItemFilterMapper(self::SOURCE);
    self::assertSame(self::SOURCE, iterator_to_array($filter));

    $filter->setSkipItems(-1);
    self::assertSame(self::SOURCE, iterator_to_array($filter));

    $filter->setSkipItems(0);
    self::assertSame(self::SOURCE, iterator_to_array($filter));

    $filter->setSkipItems(1);
    self::assertSame([2, 3, 4, 5], iterator_to_array($filter));

    $filter->setSkipItems(2);
    self::assertSame([3, 4, 5], iterator_to_array($filter));
  }
}
