예제 #1
0
 /**
  * @test
  */
 public function find_offsetLimit()
 {
     $storage = new NullStorage();
     $query = new Query();
     $query->setOffset(10);
     $query->setLimit(1000);
     $query->addFilter(new KeyValueFilter('foo', 'bar'));
     $storage->find($query, new ModelFixture());
 }
예제 #2
0
 /**
  * @test
  */
 public function find_limit_offset()
 {
     $pdo = $this->getPDO();
     $this->createTestTable($pdo);
     $storage = new SqlStorage($pdo, 'test');
     $model1 = new ModelFixture();
     $model1->foo = 'test';
     $model1->bar = 2;
     $model2 = new ModelFixture();
     $model2->foo = 'bar';
     $model2->bar = 5;
     $model3 = new ModelFixture();
     $model3->foo = 'bar2';
     $model3->bar = 15;
     $storage->persist($model1);
     $storage->persist($model2);
     $storage->persist($model3);
     $model = new ModelFixture();
     $query = new Query();
     $query->setOffset(1);
     $query->setLimit(1);
     $modelList = $storage->find($query, $model);
     $this->assertFalse($modelList->isEmpty());
     $this->assertEquals(1, $modelList->count());
     foreach ($modelList as $item) {
         $this->assertEquals($model2, $item);
     }
 }