Exemple #1
0
 /**
  * @depends testCreateStarredTables
  */
 public function testToggleModelStarStatus()
 {
     $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());
     $this->assertFalse(StarredUtil::isModelStarred($account));
     $this->assertEquals('icon-star starred', StarredUtil::toggleModelStarStatus('Account', $account->id));
     $this->assertTrue(StarredUtil::isModelStarred($account));
     $this->assertEquals('icon-star unstarred', StarredUtil::toggleModelStarStatus('Account', $account->id));
     $this->assertFalse(StarredUtil::isModelStarred($account));
 }
 public function actionToggleStar($modelClassName, $modelId)
 {
     echo StarredUtil::toggleModelStarStatus($modelClassName, (int) $modelId);
 }