public function executeFavouriteActs() { // embed javascripts for advanced javascripts $response = sfContext::getInstance()->getResponse(); $response->addJavascript('jquery.js'); // calcola l'utente e l'id $this->user_id = $this->getUser()->getId(); $this->user = OppUserPeer::retrieveByPK($this->user_id); // estrae gli atti favoriti $this->favourite_acts = sfBookmarkingPeer::getAllPositivelyBookmarked($this->user_id); }
$t->ok($obj1->hasBeenNegativelyBookmarked($user_2_id) == true, 'hasBeenNegativelyBookmarked() - obj1 was negatively bookmarked by user 1'); $t->ok($obj1->hasBeenNegativelyBookmarked($user_3_id) == false, 'hasBeenNegativelyBookmarked() - obj1 was NOT negatively bookmarked by user 1'); $t->diag('List of bookmarked objects'); $bookmarked_ids = sfBookmarkingPeer::getAllPositivelyBookmarkedIds($user_1_id); $t->ok($bookmarked_ids[TEST_CLASS][0] == $obj1->getId(), 'sfBookmarkingPeer::getAllPositivelyBookmarkedIds() - is working'); $bookmarked_ids = sfBookmarkingPeer::getAllPositivelyBookmarkedIds($user_2_id); $t->ok($bookmarked_ids == array(), 'sfBookmarkingPeer::getAllPositivelyBookmarkedIds() - empty case scenario'); $bookmarked_ids = sfBookmarkingPeer::getAllNegativelyBookmarkedIds($user_2_id); $t->ok($bookmarked_ids[TEST_CLASS][0] == $obj1->getId(), 'sfBookmarkingPeer::getAllNegativelyBookmarkedIds() - is working'); $bookmarked_ids = sfBookmarkingPeer::getAllNegativelyBookmarkedIds($user_1_id); $t->ok($bookmarked_ids == array(), 'sfBookmarkingPeer::getAllNegativelyBookmarkedIds() - empty case scenario'); $bookmarked_objs = sfBookmarkingPeer::getAllPositivelyBookmarked($user_1_id); $t->ok($bookmarked_objs[0] == $obj1, 'sfBookmarkingPeer::getAllPositivelyBookmarked() - is working'); $bookmarked_objs = sfBookmarkingPeer::getAllNegativelyBookmarked($user_2_id); $t->ok($bookmarked_objs[0] == $obj1, 'sfBookmarkingPeer::getAllNegativelyBookmarked() - is working'); $bookmarked_objs = sfBookmarkingPeer::getAllPositivelyBookmarked($user_2_id); $t->ok($bookmarked_objs == array(), 'sfBookmarkingPeer::getAllPositivelyBookmarked() - empty case'); $t->diag('List of some toolkit methods'); $t->ok(deppPropelActAsBookmarkableToolkit::isBookmarkable(TEST_CLASS) == true, 'deppPropelActAsBookmarkableToolkit::isBookmarkable() - is working'); $t->diag('Tests terminated'); // test object creation function _create_object() { $classname = TEST_CLASS; $method = TEST_METHOD_SETTER; if (!class_exists($classname)) { throw new Exception(sprintf('Unknow class "%s"', $classname)); } $obj = new $classname(); // set a field to set the status of the object to isModified and have the doSave() function work $obj->{$method}('Trial value');