public static function resolveSaveGameScoreAndAddPointsByCategory($gameScore, $category) { assert('is_string($category)'); $saved = $gameScore->save(); if (!$saved) { throw new FailedToSaveModelException(); } GamePointUtil::addPointsByPointData(Yii::app()->user->userModel, GamificationRules::getPointTypeAndValueDataByCategory($category)); }
/** * @depends testScoreOnImportModels */ public function testGetPointTypeAndValueDataByCategory() { $super = User::getByUsername('super'); Yii::app()->user->userModel = $super; $pointTypeAndValueData = GamificationRules::getPointTypeAndValueDataByCategory('Search'); $this->assertEquals(array('UserAdoption' => 5), $pointTypeAndValueData); }