コード例 #1
0
ファイル: JoinTest.php プロジェクト: meniam/model
 /**
  * @group Model
  * @group itrun
  */
 public function testJoin()
 {
     /**
      * @var TagModel
      */
     $productModel = ProductModel::getInstance();
     $this->assertInstanceOf('Model\\ProductModel', $productModel);
     $this->assertInstanceOf('Model\\Cond\\ProductCond', $productModel->getCond());
     /**
      * @var UserModel
      */
     $userModel = UserModel::getInstance();
     $this->assertInstanceOf('Model\\UserModel', $userModel);
     $this->assertInstanceOf('Model\\Cond\\UserCond', $userModel->getCond());
     $cond = $userModel->getCond()->where(array('email' => '*****@*****.**'));
     $userModel->delete($cond);
     /** @var UserEntity $data */
     $data = $userModel->getByEmail('*****@*****.**');
     $this->assertInstanceOf('Model\\Entity\\UserEntity', $data);
     $this->assertFalse($data->exists());
     $user = array('email' => '*****@*****.**', '_user_info' => array('about' => 'just a test'));
     $userModel->import($user);
     $data = $userModel->getByEmail('*****@*****.**');
     $this->assertInstanceOf('Model\\Entity\\UserEntity', $data);
     $this->assertTrue($data->exists());
     $cond = $userModel->getCond()->where(array('email' => '*****@*****.**'))->with(UserCond::WITH_USER_INFO);
     $user = $userModel->get($cond);
     $this->assertInstanceOf('Model\\Entity\\UserInfoEntity', $user->getUserInfo());
 }
コード例 #2
0
ファイル: GetIdsFromMixedTest.php プロジェクト: meniam/model
 /**
  * @group Model
  */
 public function testGetIdsFromMixed()
 {
     $productModel = \Model\ProductModel::getInstance();
     $this->assertEquals(array(0 => 1), $productModel->getIdsFromMixed(1));
     $this->assertEquals(array(), $productModel->getIdsFromMixed(null));
 }