예제 #1
0
 /**
  * @test
  * @dataProvider rawQueryDataProvider
  * @param string $query
  * @param int $resultCount
  */
 public function testRawQuery($query, $resultCount)
 {
     $pdo = $this->getPDO();
     $this->createTestTable($pdo);
     $storage = new SqlStorage($pdo, 'test');
     $model = new ModelFixture();
     $model->foo = 'test';
     $model->bar = 'bar';
     $storage->persist($model);
     $model2 = new ModelFixture();
     $model2->foo = 'test2';
     $model2->bar = 'foo';
     $storage->persist($model2);
     $model3 = new ModelFixture();
     $model3->foo = 'bar';
     $model3->bar = 'foo';
     $storage->persist($model3);
     $result = $storage->find(new RawSqlQuery($query), $model);
     $this->assertCount($resultCount, $result);
 }
예제 #2
0
 /**
  * @test
  */
 public function unknownFilter()
 {
     $this->expectException(NotSupportedFilterException::class);
     $pdo = $this->getPDO();
     $storage = new SqlStorage($pdo, 'test');
     $model = new ModelFixture();
     $query = new Query();
     $query->addFilter(new UnknownFilterFixture());
     $storage->find($query, $model);
 }