/**
  * @test
  */
 public function find_moreKeyValue()
 {
     $mongoCollection = $this->getMongoCollectionMock();
     $mongoCollection->expects($this->once())->method(self::FIND_METHOD)->with($this->equalTo(array('foo' => 'bar', 'bar' => 10)))->will($this->returnValue(array(array('foo' => 'bar'))));
     $mongoStorage = new MongoStorage($mongoCollection);
     $model = new ModelFixture();
     $query = new Query();
     $query->addFilter(KeyValueFilter::create('foo', 'bar'));
     $query->addFilter(KeyValueFilter::create('bar', 10));
     $mongoStorage->find($query, $model);
 }
Example #2
0
 /**
  * @test
  */
 public function find_multiQueryNotFound()
 {
     $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;
     $storage->persist($model1);
     $storage->persist($model2);
     $model = new ModelFixture();
     $query = new Query();
     $query->addFilter(KeyValueFilter::create('foo', 'bar'));
     $query->addFilter(KeyValueFilter::create('bar', 2));
     $modelList = $storage->find($query, $model);
     $this->assertTrue($modelList->isEmpty());
 }