예제 #1
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$b = new CrmTestFunctional(new sfBrowser());
$b->loadData();
$b->signin();
$b->setTester('doctrine', 'sfTesterDoctrine');
$t = $b->test();
$issue_table = Doctrine::getTable('Issue');
$databaseManager = new sfDatabaseManager($configuration);
$b->get('/issues')->with('request')->begin()->isParameter('module', 'issues')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('h1', '/Issues List/', array('position' => 1))->end();
$issue1 = array('title' => 'Test issue 1', 'assigned_to' => '3');
$issue2 = array('title' => 'Test issue 2', 'assigned_to' => '2');
$b->info('create new issue')->click('Create new issue')->click('Save', array('issue' => $issue1))->with('form')->hasErrors(false)->isRedirected()->followRedirect()->with('response')->begin()->checkElement('h1', "/{$issue1['title']}/", array('position' => 1))->checkElement('.issue-activity', "/Opened/")->checkElement('.issue-activity', "/assigned to jack/")->checkElement('.issue-activity', "/by admin/")->end()->with('doctrine')->check('MailQueue', array('subject' => "%{$issue1['title']}%", 'recipients' => '*****@*****.**', 'body' => '%new issue has been assigned%', 'attemps' => '0'))->info('test resolving')->click('Edit')->click('Save', array('issue' => array('status_id' => 2)))->with('form')->hasErrors(false)->isRedirected()->followRedirect()->with('response')->begin()->checkElement('h1', "/{$issue1['title']}/", array('position' => 1))->checkElement('body', "/Resolved/", array('position' => 0))->end()->with('doctrine')->check('MailQueue', array('subject' => "%{$issue1['title']}%", 'recipients' => '*****@*****.**', 'body' => '%has been resolved%', 'attemps' => '0'));
예제 #2
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$b = new CrmTestFunctional(new sfBrowser());
$b->loadData();
$databaseManager = new sfDatabaseManager($configuration);
$b->signin();
$b->get('/contacts')->with('request')->begin()->isParameter('module', 'contacts')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->end();
// test edit page
$b->info('test edit page')->get('/people/new')->with('response')->isStatusCode()->with('request')->begin()->isParameter('module', 'people')->isParameter('action', 'new')->isParameter('id', false)->end();
// test insert Entities
$test_person = array('person' => array('name' => 'Joaquin Bravo', 'Emails' => array(array('email' => '*****@*****.**', 'type' => 1))));
$b->info('test insert person')->click('Save', $test_person)->with('form')->begin()->hasErrors(false)->end()->isRedirected()->followRedirect()->with('response')->begin()->checkElement('body', '/Joaquin Bravo/')->checkElement('body', '/jackbravo@gmail.com/')->end()->test()->like($b->getRequest()->getParameter('id'), '/\\d+/', 'Id is number');
// TODO: test for number of Phones, Locations and Emails created
$new_person_id = $b->getRequest()->getParameter('id');
// test validation
$test_person['person']['name'] = '';
$test_person['id'] = $new_person_id;
$b->info('test basic validation and form refill')->get('/people/' . $new_person_id . '/edit')->click('Save', $test_person)->with('form')->begin()->hasErrors(1)->isError('name', 1)->end()->with('response')->begin()->checkElement('form input[name="person[name]"][value=""]', true)->checkElement('form #emails input[value="*****@*****.**"]', true)->end();
// test new company creation
$company_name = uniqid('company_');
$company_count_0 = Doctrine::getTable('Company')->createQuery()->count();
$test_person = array('person' => array('name' => 'Freddy Mercury', 'company' => $company_name));
$b->info('test new company creation on create person')->get('/people/new')->click('Save', $test_person)->with('form')->begin()->hasErrors(false)->end()->isRedirected()->followRedirect()->with('response')->begin()->checkElement('body', "/{$company_name}/")->end();
$company_count_1 = Doctrine::getTable('Company')->createQuery()->count();
$b->test()->is($company_count_1, $company_count_0 + 1, 'There is one new company');
// test company search on new person
$test_person = array('person' => array('name' => 'Jim Morrison', 'company' => $company_name));
$b->info('test company search on create person')->get('/people/new')->click('Save', $test_person)->with('form')->begin()->hasErrors(false)->end()->isRedirected()->followRedirect()->with('response')->begin()->checkElement('body', "/{$company_name}/")->end();
$company_count_2 = Doctrine::getTable('Company')->createQuery()->count();
$b->test()->is($company_count_1, $company_count_2, 'There is NO new company');
예제 #3
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new CrmTestFunctional(new sfBrowser());
$browser->loadData()->signin()->get('/contacts')->click('Johnnie Walker')->with('response')->begin()->isStatusCode(200)->checkElement('.notes .note', 2)->end()->get('/contacts?show=companies')->click('Axai Inc.')->with('response')->begin()->isStatusCode(200)->checkElement('.notes .note', 1)->end()->get('/projects')->click('Muestra')->with('response')->begin()->isStatusCode(200)->checkElement('.notes .note', 2)->end();
예제 #4
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new CrmTestFunctional(new sfBrowser());
$browser->loadData()->signin()->info('pagination')->get('/contacts')->with('response')->begin()->isStatusCode(200)->checkElement('.contact h2', '/Jack Daniels/', array('position' => 1))->checkElement('.pagination-desc', '!/0/')->end()->info('edit link for people')->click('Jack Daniels')->with('response')->begin()->checkElement('#content h1', '/Jack Daniels/', array('position' => 0))->checkElement('.subheader', '/Edit contact info/')->end()->click('Edit contact info')->with('request')->begin()->isParameter('module', 'people')->isParameter('action', 'edit')->end()->with('response')->isStatusCode(200)->info('edit link for companies')->get('/contacts?show=companies')->click('Axai Inc.')->with('response')->begin()->checkElement('#content h1', '/Axai Inc./', array('position' => 0))->checkElement('.subheader', '/Edit/')->end()->click('Edit')->with('request')->begin()->isParameter('module', 'companies')->isParameter('action', 'edit')->end()->with('response')->isStatusCode(200);