<?php

require_once dirname(__FILE__) . '/../../bootstrap/functional.php';
# load fixtures of this plugin
$propelData->loadData(sfConfig::get('sf_plugins_dir') . '/sfNewsletterPlugin/data/fixtures');
$browser = new sfTestFunctional(new sfBrowser());
$limeTest = $browser->test();
$browser->getAndCheck('sfSubscription', 'subscribe', '/newsletter/subscription', 200);
$browser->responseContains(sfSubscribeForm::PARAMETER_NAME);
$name = 'A valid username';
$email = '*****@*****.**';
$postData = array('name' => $name, 'email' => $email);
$browser->post('/newsletter/subscription', array(sfSubscribeForm::PARAMETER_NAME => $postData));
$browser->isStatusCode(200);
$browser->responseContains('An email has been sent to you, in order to verify your address.');
$limeTest->plan += 3;
$subscriber = SubscriberPeer::retrieveByEmail($email);
$limeTest->isa_ok($subscriber, 'Subscriber', 'Subscriber found.');
$limeTest->is($subscriber->getName(), $name, 'Name matches.');
$limeTest->is($subscriber->getEmail(), $email, 'Email matches.');
$limeTest->plan += 3;
$activationHash = $subscriber->getActivateHash();
$unsubscribeHash = $subscriber->getUnsubscribeHash();
$limeTest->isnt(empty($activationHash), true, 'Activation Hash set.');
$limeTest->isnt(empty($unsubscribeHash), true, 'Unsubscribe Hash set.');
$limeTest->isnt($subscriber->isSubscribed(), true, 'Subscriber is not activated, yet.');
# test activation and unsubscribe with fixtures
$limeTest->plan += 1;
$subscriber = SubscriberPeer::retrieveByEmail('*****@*****.**');
$limeTest->ok(!$subscriber->isSubscribed(), 'Subscriber not activated, yet.');
$browser->getAndCheck('sfSubscription', 'activate', '/newsletter/subscription/activate/' . $subscriber->getId() * 42 . '?' . activateAction::PARAMETER_NAME . '=invalid', 404);
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new sfTestFunctional(new sfBrowser());
$informationObject = new QubitInformationObject();
$informationObject->save();
$browser->post(';digitalobject/create', array('file' => sfConfig::get('sf_test_dir') . '/fixtures/echo.jpg', 'informationObject' => $informationObject->id . ';isad'))->with('request')->begin()->isParameter('module', 'digitalobject')->isParameter('action', 'edit')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '/Untitled/')->end();
Esempio n. 3
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new sfTestFunctional(new sfBrowser());
$email = rand() . '@example.com';
$password = rand();
$user = new QubitUser();
$user->email = $email;
$user->setPassword($password);
$user->save();
$relation = new QubitUserRoleRelation();
$relation->userId = $user->id;
$relation->roleId = QubitRole::ADMINISTRATOR_ID;
$relation->save();
$browser->post(';user/login', array('login' => array('email' => $email, 'password' => $password)));
$scopeAndContent = rand();
$identifier = rand();
$title = rand();
$informationObject = new QubitInformationObject();
$informationObject->parentId = QubitInformationObject::ROOT_ID;
$informationObject->scopeAndContent = $scopeAndContent;
$informationObject->identifier = $identifier;
$informationObject->title = $title;
$informationObject->save();
$browser->get('/' . $informationObject->id . ';dc?sf_format=xml');
$user->delete();
$informationObject->delete();
$doc = new DOMDocument();
$doc->loadXML($browser->getResponse()->getContent());
$xpath = new DOMXPath($doc);
$xpath->registerNamespace('dc', 'http://purl.org/dc/elements/1.1/');