Example #1
0
 public function setUp()
 {
     parent::setUp();
     $this->controller = new OrderController(self::getApplication());
     $this->initOrder();
     $this->controller->setOrder($this->order);
     $this->controller->setUser($this->user);
 }
Example #2
0
 public function setUp()
 {
     parent::setUp();
     ActiveRecordModel::executeUpdate('DELETE FROM EavField');
     $this->controller = new UserController(self::getApplication());
     $this->initOrder();
     $this->controller->setOrder($this->order);
     $this->controller->setUser($this->user);
 }
 public function testReviewApproval()
 {
     $config = self::getApplication()->getConfig();
     $config->set('RATING_SAME_IP_TIME', 0);
     $this->request->set('rating_', 4);
     $this->request->set('ajax', 'true');
     $this->request->set('nickname', 'tester');
     $this->request->set('text', 'review');
     $this->request->set('title', 'summary');
     // no automatic approval
     $config->set('APPROVE_REVIEWS', 'APPROVE_REVIEWS_NONE');
     $this->controller->rate();
     $this->assertEqual($this->getReviewCount(), 0);
     $config->set('APPROVE_REVIEWS', 'APPROVE_REVIEWS_USER');
     $this->controller->rate();
     $this->assertEqual($this->getReviewCount(), 0);
     // auto approve for registered users only
     $config->set('APPROVE_REVIEWS', 'APPROVE_REVIEWS_USER');
     $user = User::getNewInstance('*****@*****.**');
     $user->save();
     $this->controller->setUser($user);
     $this->controller->rate();
     $this->assertEqual($this->getReviewCount(), 1);
 }
Example #4
0
 * Created by Yogesh on 11/20/2015.
 * 
 */
include_once "../model/PoiController.php";
include_once "../model/UsersController.php";
include_once "../model/objects/User.php";
include_once "../model/objects/POI.php";
include_once "../model/objects/Contribution.php";
include_once "../model/objects/Category.php";
include_once "../model/objects/ParentCategory.php";
include_once "../model/CategoryController.php";
include_once "../model/ContributionController.php";
header("Content-Type: text/plain");
$cont = new ContributionController();
$data = $cont->getAll();
print_r($data);
exit;
$dataArray = array("Pokhara||Gandaki Zone, Kaski District, Nepal||http://en.wikipedia.org/wiki/Pokhara||city||28.2095379,83.9914028", "Hyatt Regency||Nepal||null||bus station||27.7193693,85.3541166", "Ason||Nepal||null||neighbourhood||27.7075079,85.3122521", "Lainchour Chowk Bus Stop||Nepal||null||bus station||27.7169967,85.316039", "Airport Bus Station||Nepal||null||bus station||27.7007168,85.3537173", "Dillibazaar stop||Nepal||null||bus station||27.7053698,85.3267594");
$currentUser = $userController->find(3);
$poiIdDummy = 56;
foreach ($dataArray as $key => $value) {
    $row = $value;
    $data = explode("||", $row);
    $category = new Category();
    $category->setUser($currentUser);
    $category->setSubCategory($data[3]);
    $poi = new POI();
    $poi->init($poiIdDummy, $data[0], $data[1], $data[4], $category, "", "", "", "", $currentUser);
    $contributionController->add($poi);
    $poiIdDummy++;
}