コード例 #1
0
ファイル: MapperTest.php プロジェクト: taichiatshanghai/yamop
 public function testFindAndGetWithFetchJsonSet()
 {
     $data = $this->_saveListData();
     $mapper = new Mapper('\\Model\\Simple', Mapper::FETCH_JSON);
     $result = $mapper->find()->get();
     $this->assertInternalType('string', $result);
     $result = json_decode($result);
     $current = current($result);
     $this->assertInternalType('array', $result);
     $this->assertInstanceOf('stdClass', $current);
     $this->assertAttributeNotEmpty('_id', $current);
     $this->assertCount(count($data), $result);
     $mapper = new Mapper('\\Model\\Simple');
     $mapper->setFetchType(Mapper::FETCH_JSON);
     $result = $mapper->find()->get();
     $this->assertInternalType('string', $result);
     $result = json_decode($result);
     $current = current($result);
     $this->assertInternalType('array', $result);
     $this->assertInstanceOf('stdClass', $current);
     $this->assertAttributeNotEmpty('_id', $current);
     $this->assertCount(count($data), $result);
 }