示例#1
0
 /**
  * @depends testCreateStarredTables
  */
 public function testUnmarkModelAsStarred()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $account = new Account();
     $account->owner = $super;
     $account->name = 'Test Account';
     $account->officePhone = '1234567890';
     $this->assertTrue($account->save());
     StarredUtil::markModelAsStarred($account);
     StarredUtil::unmarkModelAsStarred($account);
     $tableName = StarredUtil::getStarredTableName('Account');
     $sql = "SELECT id FROM {$tableName} WHERE user_id = :userId AND model_id = :modelId;";
     $rows = R::getAll($sql, $values = array(':userId' => $super->id, ':modelId' => $account->id));
     $this->assertCount(0, $rows);
 }
 /**
  * @depends testCreateStarredTables
  */
 public function testUnmarkModelAsStarred()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $account = new Account();
     $account->owner = $super;
     $account->name = 'Test Account';
     $account->officePhone = '1234567890';
     $this->assertTrue($account->save());
     StarredUtil::markModelAsStarred($account);
     StarredUtil::unmarkModelAsStarred($account);
     $starredRecords = AccountStarred::getCountByUserIdAndModelId($super->id, $account->id);
     $this->assertEquals(0, $starredRecords);
 }