public function testResolveNewCollectionItems()
 {
     $bool = GameCollection::shouldReceiveCollectionItem();
     $this->assertTrue(is_bool($bool));
     Yii::app()->user->userModel = User::getByUsername('super');
     $availableTypes = GameCollection::getAvailableTypes();
     $this->assertCount(31, $availableTypes);
     $collection = GameCollection::resolveByTypeAndPerson($availableTypes[0], Yii::app()->user->userModel);
     $itemsData = $collection->getItemsData();
     $randomItem = array_rand($itemsData, 1);
     $compareData = array('Gate' => 0, 'Passport' => 0, 'Pilot' => 0, 'Luggage' => 0, 'TowTruck' => 0);
     $this->assertTrue($randomItem == 'Gate' || $randomItem == 'Passport' || $randomItem == 'Pilot' || $randomItem == 'Luggage' || $randomItem == 'TowTruck');
     $compareData[$randomItem] = $compareData[$randomItem] + 1;
     $itemsData[$randomItem] = $itemsData[$randomItem] + 1;
     $collection->setItemsData($itemsData);
     $collection->save();
     $this->assertEquals($compareData, $collection->getItemsData());
 }
 /**
  * @depends testRedeem
  * @return boolean
  */
 public function testShouldReceiveCollectionItem()
 {
     Yii::app()->user->userModel = User::getByUsername('steven');
     $bool = GameCollection::shouldReceiveCollectionItem();
     $this->assertTrue($bool === true || $bool === false);
 }
 public function resolveNewCollectionItems()
 {
     if (Yii::app()->gameHelper->getModalCollectionsEnabled() && GameCollection::shouldReceiveCollectionItem()) {
         return GameCollection::getARandomCollectionItemForUser(Yii::app()->user->userModel);
     }
 }