Exemplo n.º 1
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration);
$browser->login('root', 'evil');
$browser->info('1 - GetBoard')->get('/board/index')->with('request')->begin()->isParameter('module', 'board')->isParameter('action', 'index')->end()->info('1.1 - is everything ok on the board')->with('response')->begin()->isStatusCode(200)->checkElement('title', 'Dashboard')->checkElement('.board_col', 2)->checkElement('.board_col:first .widget', 2)->checkElement('.board_col:last .widget', 4)->end();
$browser->with('response')->begin()->checkElement('.board_col:last .widget:last .widget_top_bar span', '/My Loans/')->checkElement('#myLoans .widget_content table tbody tr', 5)->checkElement('#myLoans .widget_content table tbody tr:first td:nth-child(2)', '/Dragon of goyet/')->checkElement('#myLoans .widget_content table tbody tr:first td:last a[class=edit_loan]', 1)->end();
$browser->with('response')->begin()->checkElement('tfoot .pager_separator', false)->checkElement('tfoot tr:eq(1) .add_link', 1)->checkElement('tfoot tr:eq(1) .view_all', true)->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('executeSearch')->get('/catalogue/search?searchCatalogue[name]=falco&searchCatalogue[table]=taxonomy')->with('request')->begin()->isParameter('module', 'catalogue')->isParameter('action', 'search')->end()->with('response')->begin()->isStatusCode(200)->checkElement('table tbody tr', 9)->checkElement('tbody tr:first span', '/Falco Class/')->end()->info('executeTree');
$items = Doctrine::getTable('Taxonomy')->findByName('Falco Peregrinus (Duchesnus Brulus 1912)');
$browser->get('/catalogue/tree?table=taxonomy&id=' . $items[0]->getId())->with('response')->begin()->isStatusCode(200)->checkElement('body > div.wrapper > ul > li', 8)->checkElement('body > div.wrapper > ul li:first', '/Eucaryota/')->checkElement('body > div.wrapper > ul li:last', '/Duchesnus/')->end()->info('Relation');
$items = Doctrine::getTable('CatalogueRelationships')->getRelationsForTable('taxonomy', 4, 'current_name');
$browser->get('/catalogue/relation?type=rename&table=taxonomy&rid=4&id=' . $items[0]['id'])->with('response')->begin()->isStatusCode(200)->checkElement('label[for="catalogue_relationships_record_id_2"]', 'Renamed in')->checkElement('form')->checkElement('input[id="catalogue_relationships_record_id_2_name"][value="Falco Peregrinus Tunstall, 1771"]')->end();
$items = Doctrine::getTable('CatalogueRelationships')->getRelationsForTable('taxonomy', 4, 'recombined from');
$browser->get('/catalogue/relation?type=recombined&table=taxonomy&rid=4&id=' . $items[0]['id'])->with('response')->begin()->isStatusCode(200)->checkElement('label[for="catalogue_relationships_record_id_2"]', 'Recombined from')->checkElement('form')->checkElement('input[id="catalogue_relationships_record_id_2_name"][value="Falco Peregrinus recombinus"]')->end()->info('SaveRelation')->get('/catalogue/relation?type=recombined&table=taxonomy&rid=4')->with('response')->begin()->isStatusCode(200)->checkElement('label[for="catalogue_relationships_record_id_2"]', 'Recombined from')->checkElement('form')->checkElement('input[id="catalogue_relationships_record_id_2_name"][value=""]')->end()->click('Save', array('catalogue_relationships' => array('record_id_2' => '2', 'referenced_relation' => 'taxonomy', 'relationship_type' => 'recombined from', 'record_id_1' => '4')));
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$items = Doctrine::getTable('CatalogueRelationships')->getRelationsForTable('taxonomy', 4, 'recombined from');
$tax = Doctrine::getTable('Taxonomy')->find($items[1]['record_id_2']);
$browser->get('/catalogue/relation?type=recombined&table=taxonomy&rid=4&id=' . $items[1]['id'])->with('response')->begin()->isStatusCode(200)->checkElement('label[for="catalogue_relationships_record_id_2"]', 'Recombined from')->checkElement('form')->checkElement('input[id="catalogue_relationships_record_id_2_name"]')->checkElement('input[id="catalogue_relationships_record_id_2_name"][value="' . $tax->getName() . '"]')->end()->info('DeleteRelated')->get('/catalogue/deleteRelated?table=catalogue_relationships&id=' . $items[1]['id'])->with('response')->begin()->isStatusCode(200)->end()->get('/catalogue/relation?type=recombined&table=taxonomy&rid=4&id=' . $items[1]['id'])->with('response')->begin()->isStatusCode(200)->checkElement('label[for="catalogue_relationships_record_id_2"]', 'Recombined from')->checkElement('form')->checkElement('#relation_catalogue_name', '')->end();
$items = Doctrine::getTable('Taxonomy')->findByName('Falco Peregrinus (Duchesnus Brulus 1912)');
$parent_item = Doctrine::getTable('Taxonomy')->findOneByLevelRef(48);
$items[0]->setParentRef($parent_item->getId());
$items[0]->save();
$browser->info('Test the possible upper levels check function')->get('/catalogue/searchPUL/table/taxonomy/level_id/' . $items[0]->getLevelRef() . '/parent_id/' . $parent_item->getId())->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end()->get('/catalogue/searchPUL/table/taxonomy/level_id/20/parent_id/' . $parent_item->getId())->with('response')->begin()->isStatusCode(200)->matches('/not ok/')->end()->get('/catalogue/searchPUL/table/taxonomy/level_id/50/parent_id/' . $parent_item->getId())->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end()->get('/catalogue/searchPUL/table/taxonomy/level_id/1/parent_id/' . $parent_item->getId())->with('response')->begin()->isStatusCode(200)->matches('/top/')->end();
Exemplo n.º 3
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Index')->get('/gtu/index')->with('response')->begin()->isStatusCode(200)->checkElement('h1', 'Sampling location search')->checkElement('#gtu_filters_code', '')->checkElement('#gtu_filters_gtu_from_date_day > option:first_element', 'dd')->checkElement('#gtu_filters_gtu_from_date_month > option:first_element', 'mm')->checkElement('#gtu_filters_gtu_from_date_year > option:first_element', 'yyyy')->checkElement('#gtu_filters_gtu_to_date_day > option:first_element', 'dd')->checkElement('#gtu_filters_gtu_to_date_month > option:first_element', 'mm')->checkElement('#gtu_filters_gtu_to_date_year > option:first_element', 'yyyy')->checkElement('form input[type="submit"]')->end()->click('input[type="submit"]', array('gtu_filters' => array('gtu_from_date' => array('month' => 10))))->with('response')->begin()->isStatusCode()->checkElement('.error_list li', '/Year missing./')->end()->get('/gtu/index')->click('input[type="submit"]', array('gtu_filters' => array('Tags' => array(0 => array('tag' => 'Belgique')))))->with('response')->begin()->checkElement('.paging_info')->checkElement('.results tbody tr', 2)->end()->get('/gtu/index')->click('input[type="submit"]', array('gtu_filters' => array('Tags' => array(0 => array('tag' => 'Belgique; Antartica')))))->with('response')->begin()->checkElement('.paging_info')->checkElement('.results tbody tr', 3)->end()->get('/gtu/index')->click('input[type="submit"]', array('gtu_filters' => array('Tags' => array(0 => array('tag' => 'Belgique; Antartica'), 1 => array('tag' => 'Belgïe')))))->with('response')->begin()->checkElement('.paging_info')->checkElement('.results tbody tr', 1)->end()->info('New')->get('/gtu/index')->click('New')->with('response')->begin()->isStatusCode(200)->checkElement('h1', 'New Sampling Location')->checkElement('#gtu_code')->checkElement('.gtu_groups_add')->end()->click('Save', array('gtu' => array('code' => 'Brol')))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('response')->begin()->isStatusCode(200)->checkElement('h1', 'Edit Sampling Location')->checkElement('input[value="Brol"]')->checkElement('.gtu_groups_add')->end()->click('Save', array('gtu' => array('code' => 'Brol2', 'newVal' => array(2 => array('group_name' => 'administrative area', 'sub_group_name' => 'City', 'tag_value' => 'Brussels; Ici')))))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('response')->begin()->isStatusCode(200)->checkElement('h1', 'Edit Sampling Location')->checkElement('input[value="Brol2"]')->end()->info('Tags')->get('gtu/purposeTag?group_name=administrative%20area&sub_group_name=city&value=Brussels;Bruxelles')->with('response')->begin()->isStatusCode(200)->checkElement('li.tag_size_5', 'Bruselas')->checkElement('li.tag_size_3', 'Bruselo')->end()->get('gtu/purposeTag?group_name=administrative%20area&sub_group_name=city&value=Brussels;Bruxelles;Bruselas')->with('response')->begin()->isStatusCode(200)->checkElement('li.tag_size_5', 'Bruselo')->end()->get('gtu/purposeTag?value=Brussels;Bruxelles;Bruselas')->with('response')->begin()->isStatusCode(200)->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->get('/specimensearch/index')->with('request')->begin()->isParameter('module', 'specimensearch')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('body', '!/This is a temporary page/')->checkElement('ul#taxon_child_syn_included input[name="specimen_search_filters[taxon_child_syn_included]"][type="checkbox"]')->checkElement('ul#taxon_child_syn_included input[name="specimen_search_filters[taxon_child_syn_included]"][type="checkbox"][checked="checked"]', '')->end();
Exemplo n.º 5
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Index')->get('/people/index')->with('request')->begin()->isParameter('module', 'people')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('.search_results_content')->checkElement('#people_filters_family_name')->end()->click('.search_submit', array('people_filters' => array('family_name' => 'poil', 'is_physical' => 1)))->with('response')->begin()->isStatusCode(200)->checkElement('.results_container')->checkElement('.results_container .results > tbody > tr', 2)->checkElement('.results_container .results > tbody > tr.hidden', 1)->end()->get('/people/index')->click('.search_submit', array('people_filters' => array('family_name' => 'ntol', 'is_physical' => 1)))->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/No Matching Items/', 'Content is ok');
$browser->get('/people/index')->click('New')->with('response')->begin()->isStatusCode(200)->end()->click('Save', array('people' => array('family_name' => '', 'additional_names' => '')))->with('form')->begin()->hasErrors(1)->isError('family_name', 'required')->end()->click('Save', array('people' => array('family_name' => 'Dupont', 'additional_names' => 'jr')))->with('response')->begin()->isRedirected()->end()->followRedirect();
$nitems = Doctrine::getTable('People')->findByAdditionalNames('jr');
$browser->test()->is($nitems[0]->getFamilyName(), 'Dupont', 'We have the new encoded people');
$browser->with('request')->begin()->isParameter('module', 'people')->isParameter('action', 'edit')->end()->with('response')->begin()->isStatusCode(200)->end()->click('Save', array('people' => array('family_name' => 'Dupond', 'additional_names' => 'jr')))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'people')->isParameter('action', 'edit')->end()->with('response')->begin()->isStatusCode(200)->checkElement('input[value="Dupond"]')->end()->click('Delete')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'people')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->end();
$nitems = Doctrine::getTable('People')->findByAdditionalNames('jr');
$browser->test()->is($nitems->count(), 0, 'We have no matching people');
$browser->info('Address')->click('.search_submit', array('people_filters' => array('family_name' => 'poil', 'is_physical' => 1)))->click('td.edit a:nth-child(2)')->with('response')->begin()->isStatusCode(200)->checkElement('#address tbody tr', 0)->end()->click('#address a.link_catalogue')->with('response')->begin()->isStatusCode(200)->end()->click('Save')->with('response')->begin()->isStatusCode(200)->end()->with('form')->begin()->hasErrors(2)->isError('locality', 'required')->isError('country', 'required')->end()->click('Save', array('people_addresses' => array('locality' => 'Bruxelles', 'country' => 'Belgium', 'tag' => 'home,pref')))->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->get('/people/index')->click('.search_submit', array('people_filters' => array('family_name' => 'poil', 'is_physical' => 1)))->click('td.edit a:nth-child(2)')->with('response')->begin()->isStatusCode(200)->checkElement('#address tbody tr', 1)->checkElement('#address tbody tr .tag', 2)->end()->click('#address table tbody a.link_catalogue')->with('response')->begin()->isStatusCode(200)->checkElement('input[value="Bruxelles"]')->end()->click('.delete_button')->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->info('Comm')->get('/people/index')->click('.search_submit', array('people_filters' => array('family_name' => 'poil', 'is_physical' => 1)))->click('td.edit a:nth-child(2)')->with('response')->begin()->isStatusCode(200)->checkElement('#comm tbody tr', 0)->end()->click('#comm a.link_catalogue')->with('response')->begin()->isStatusCode(200)->end()->click('Save')->with('response')->begin()->isStatusCode(200)->end()->with('form')->begin()->hasErrors(1)->isError('entry', 'required')->end()->click('Save', array('people_comm' => array('entry' => '+32478.254415', 'comm_type' => 'phone/fax', 'tag' => 'home')))->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->get('/people/index')->click('.search_submit', array('people_filters' => array('family_name' => 'poil', 'is_physical' => 1)))->click('td.edit a:nth-child(2)')->with('response')->begin()->isStatusCode(200)->checkElement('#comm tbody tr', 1)->checkElement('#comm tbody tr .tag', 'Home')->end()->click('#comm table tbody a.link_catalogue')->with('response')->begin()->isStatusCode(200)->checkElement('input[value="+32478.254415"]')->end()->click('.delete_button')->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->info('Relation')->get('/people/index')->click('.search_submit', array('people_filters' => array('family_name' => 'poil', 'is_physical' => 1)))->click('td.edit a:nth-child(2)')->with('response')->begin()->isStatusCode(200)->checkElement('#relation tbody tr', 0)->end()->click('#relation a.link_catalogue')->with('response')->begin()->isStatusCode(200)->end()->click('Save')->with('response')->begin()->isStatusCode(200)->end()->with('form')->begin()->hasErrors(1)->isError('person_1_ref', 'required')->end();
$nitems = Doctrine::getTable('Institutions')->findOneByFamilyName('UGMM');
$browser->click('Save', array('people_relationships' => array('person_1_ref' => $nitems->getId(), 'relationship_type' => 'work for', 'person_user_role' => 'Manager')))->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->get('/people/index')->click('.search_submit', array('people_filters' => array('family_name' => 'poil', 'is_physical' => 1)))->click('td.edit a:nth-child(2)')->with('response')->begin()->isStatusCode(200)->checkElement('#relation tbody tr', 1)->end()->click('#relation table tbody a.link_catalogue')->with('response')->begin()->isStatusCode(200)->checkElement('input[value="Manager"]')->end()->click('.delete_button')->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->info('Lang')->get('/people/index')->click('.search_submit', array('people_filters' => array('family_name' => 'poil', 'is_physical' => 1)))->click('td.edit a:nth-child(2)')->with('response')->begin()->isStatusCode(200)->checkElement('#lang tbody tr', 0)->end()->click('#lang a.link_catalogue')->with('response')->begin()->isStatusCode(200)->end()->click('Save', array('people_languages' => array('language_country' => 'ddddddd', 'mother' => '')))->with('response')->begin()->isStatusCode(200)->end()->with('form')->begin()->hasErrors(1)->isError('language_country', 'invalid')->end();
$browser->click('Save', array('people_languages' => array('language_country' => 'am', 'mother' => 'yes', 'preferred_language' => 'yes')))->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->get('/people/index')->click('.search_submit', array('people_filters' => array('family_name' => 'poil', 'is_physical' => 1)))->click('td.edit a:nth-child(2)')->with('response')->begin()->isStatusCode(200)->checkElement('#lang tbody tr', 1)->checkElement('#lang tbody tr td:first', '/Preferred/')->end()->click('#lang .widget_content > a.link_catalogue')->click('Save', array('people_languages' => array('language_country' => 'fr', 'mother' => '', 'preferred_language' => 'yes')))->with('response')->begin()->isStatusCode(200)->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
Doctrine_Query::create()->delete('Insurances')->execute();
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$items = Doctrine::getTable('Igs')->findByIgNum('10795');
$browser->info('New Insurance for a given IG')->get('/insurances/add?table=igs&id=' . $items[0]->getId())->with('response')->begin()->isStatusCode()->checkElement('div#insurances_screen')->checkElement('form[class="edition qtiped_form"][id="insurances_form"]')->checkElement('form input[type="hidden"][name="insurances[referenced_relation]"][value="igs"]')->checkElement('form input[type="hidden"][name="insurances[record_id]"][value="' . $items[0]->getId() . '"]')->checkElement('form table tbody tr:nth-child(2) label[for="insurances_insurance_value"]')->checkElement('form table tbody tr:nth-child(2) input[id="insurances_insurance_value"]')->checkElement('form table tbody tr:nth-child(3) input[id="insurances_insurance_currency_input"][value="€"]')->checkElement('form table tbody tr:nth-child(3) select option', 0)->checkElement('form table tbody tr:nth-child(4) select[id="insurances_date_from_day"] option[selected="selected"]', '')->checkElement('form table tbody tr:nth-child(5) select[id="insurances_date_to_day"] option[selected="selected"]', '')->checkElement('form table tbody tr:nth-child(6) input[id="insurances_insurer_ref_name"]')->checkElement('form table tbody tr:nth-child(7) input[id="insurances_contact_ref_name"]')->end()->info('Try to save no value for IG 10795: wait for value required error...')->click('Save', array('insurances' => array('insurance_value' => '', 'insurance_currency' => '€', 'date_from' => array('day' => 01, 'month' => 01, 'year' => 2000), 'date_to' => array('day' => 01, 'month' => 01, 'year' => 1999))))->with('form')->begin()->hasErrors(2)->isError('insurance_value', 'required')->end()->info('Save 750€ value for IG 10795')->click('Save', array('insurances' => array('insurance_value' => '750', 'insurance_currency' => '€', 'date_from' => array('day' => 01, 'month' => 01, 'year' => 2000), 'date_to' => array('day' => 01, 'month' => 01, 'year' => 2001))))->get('/insurances/add?table=igs&id=' . $items[0]->getId())->with('response')->begin()->checkElement('form table tbody tr:nth-child(3) input#insurances_insurance_currency_input')->checkElement('form table tbody tr:nth-child(3) select option[value="€"]', '€')->end();
$items = Doctrine::getTable('Insurances')->findByInsuranceValue('750');
$browser->info('Delete last insurance inserted...')->get('catalogue/deleteRelated?table=insurances&id=' . $items[0]->getId())->with('response')->begin()->isStatusCode()->end();
$counting = Doctrine_Query::create()->select('count(i.id) as counting')->from('insurances i')->execute();
$browser->info('Check record has been deleted from DB')->test()->is($counting[0]->getCounting(), 0);
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->get('/loan/edit?id=1')->info('Overview')->with('request')->begin()->isParameter('module', 'loan')->isParameter('action', 'edit')->end()->with('response')->begin()->isStatusCode(200)->checkElement('#tab_0', ' < Edit loan > ')->end()->click('Items overview')->with('request')->begin()->isParameter('module', 'loan')->isParameter('action', 'overview')->end()->with('response')->begin()->isStatusCode(200)->checkElement('.warn_message')->end()->click('Save', array('loan_overview' => array('newLoanItems' => array('0' => array('specimen_ref' => '', 'ig_ref' => '', 'details' => 'details message', 'item_visible' => 'true')))))->with('response')->begin()->isRedirected()->followredirect()->end()->with('request')->begin()->isParameter('module', 'loan')->isParameter('action', 'overview')->end()->with('response')->begin()->isStatusCode(200)->checkElement('.loan_overview_form tbody tr', 3)->checkElement('textarea', 'details message')->checkElement('img[title="View"]')->checkElement('img[title="Edit"]')->checkElement('.maint_butt')->end()->info('Add Maintenance')->get('/loanitem/maintenances?ids=' . Doctrine::getTable('LoanItems')->findOneByLoanRef(1)->getId())->with('response')->begin()->isStatusCode(200)->checkElement('h1', '/Add Maintenance/')->end()->click('Add Maintenance', array('collection_maintenance' => array('category' => 'observation', 'action_observation' => 'check', 'people_ref' => Doctrine::getTable('People')->findOneByGivenName('Poilux')->getId(), 'description' => 'Ok The package is checked!')))->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end()->get('/loanitem/showmaintenances?id=' . Doctrine::getTable('LoanItems')->findOneByLoanRef(1)->getId())->with('response')->begin()->isStatusCode(200)->checkElement('.catalogue_table_view')->checkElement('.catalogue_table_view tbody tr', 1)->checkElement('.catalogue_table_view .delete_maint_button', 1)->end()->click('.delete_maint_button')->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end()->get('/loanitem/showmaintenances?id=' . Doctrine::getTable('LoanItems')->findOneByLoanRef(1)->getId())->with('response')->begin()->isStatusCode(200)->checkElement('.catalogue_table_view')->checkElement('.catalogue_table_view tbody tr', 0)->checkElement('.catalogue_table_view .delete_maint_button', 0)->end()->info('Edit Loan Item Screen')->get('/loanitem/edit?id=' . Doctrine::getTable('LoanItems')->findOneByLoanRef(1)->getId())->with('response')->begin()->isStatusCode(200)->checkElement('#mainInfo')->checkElement('.loanitem_form')->end()->click('#submit_loan_item', array('loan_items' => array('receiver' => '1', 'sender' => '1', 'newActorsSender' => array(0 => array('people_ref' => Doctrine::getTable('People')->findOneByGivenName('Poilux')->getId(), 'people_type' => 'sender', 'people_sub_type' => array(2), 'order_by' => 1)), 'newActorsReceiver' => array(0 => array('people_ref' => Doctrine::getTable('People')->findOneByGivenName('Poilux')->getId(), 'people_type' => 'receiver', 'people_sub_type' => array(2, 4, 8), 'order_by' => 1)))))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('response')->begin()->isStatusCode(200)->checkElement('#sender_body')->checkElement('#sender_body tr', 1)->end()->info('Delete Loan Item')->get('/loan/overview?id=1')->with('response')->begin()->isStatusCode(200)->checkElement('.loan_overview_form tbody tr', 3)->end()->click('Save', array('loan_overview' => array('LoanItems' => array('0' => array('specimen_ref' => '', 'ig_ref' => '', 'details' => 'details message2', 'item_visible' => '')))))->with('response')->begin()->isRedirected()->followredirect()->end()->with('response')->begin()->isStatusCode(200)->checkElement('.warn_message')->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Index')->get('/institution/index')->with('request')->begin()->isParameter('module', 'institution')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('.search_results_content')->checkElement('#institutions_filters_family_name')->end()->click('.search_submit', array('institutions_filters' => array('family_name' => 'royal', 'is_physical' => 0)))->with('response')->begin()->isStatusCode(200)->checkElement('.results_container')->checkElement('.results_container tbody tr', 1)->end()->get('/institution/index')->click('.search_submit', array('institutions_filters' => array('family_name' => 'ntol', 'is_physical' => 0)))->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/No Matching Items/', 'Content is ok');
$browser->get('/institution/index')->click('New')->with('response')->begin()->isStatusCode(200)->end()->click('Save', array('institutions' => array('family_name' => '', 'additional_names' => '', 'sub_type' => '')))->with('form')->begin()->hasErrors(1)->isError('family_name', 'required')->end()->click('Save', array('institutions' => array('family_name' => 'Banque Bruxelles Lambert', 'additional_names' => 'BBL', 'sub_type' => 'inc')))->with('response')->begin()->isRedirected()->end()->followRedirect();
$nitems = Doctrine::getTable('Institutions')->findByAdditionalNames('BBL');
$browser->test()->is($nitems[0]->getFamilyName(), 'Banque Bruxelles Lambert', 'We have the new encoded institution');
$browser->with('request')->begin()->isParameter('module', 'institution')->isParameter('action', 'edit')->end()->with('response')->begin()->isStatusCode(200)->end()->click('Save', array('institutions' => array('family_name' => 'Ing', 'additional_names' => 'Ing', 'sub_type' => 'inc')))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'institution')->isParameter('action', 'edit')->end()->with('response')->begin()->isStatusCode(200)->checkElement('input[value="Ing"]')->end()->click('Delete')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'institution')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->end();
$nitems = Doctrine::getTable('Institutions')->findByAdditionalNames('Ing');
$browser->test()->is($nitems->count(), 0, 'We have no matching institutions');
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('1 - Add a collecting method with a post method but not as a XMLHTTP Request')->get('/methods_and_tools/addMethod?value=Test')->with('response')->begin()->isStatusCode(404)->end()->info('2 - Add a collecting method with a post method as a XMLHTTP Request')->setHttpHeader("X-Requested-With", "XMLHttpRequest")->post('/methods_and_tools/addMethod?value=Test')->with('response')->begin()->isStatusCode(200)->matches('/[0-9]+/')->end()->info('3 - Try to reAdd the same collecting method.. and check we get an error')->setHttpHeader("X-Requested-With", "XMLHttpRequest")->post('/methods_and_tools/addMethod?value=Test')->with('response')->begin()->isStatusCode(200)->matches('/This method already exist/')->end()->info('4 - Add a collecting tool with a post method but not as a XMLHTTP Request')->get('/methods_and_tools/addTool?value=Test')->with('response')->begin()->isStatusCode(404)->end()->info('5 - Add a collecting tool with a post method as a XMLHTTP Request')->setHttpHeader("X-Requested-With", "XMLHttpRequest")->post('/methods_and_tools/addTool?value=Test')->with('response')->begin()->isStatusCode(200)->matches('/[0-9]+/')->end()->info('6 - Try to reAdd the same collecting tool.. and check we get an error')->setHttpHeader("X-Requested-With", "XMLHttpRequest")->post('/methods_and_tools/addTool?value=Test')->with('response')->begin()->isStatusCode(200)->matches('/This tool already exist/')->end();
Exemplo n.º 10
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->setTester('doctrine', 'sfTesterDoctrine');
$people = Doctrine::getTable('People')->findOneByFamilyName('Chambert');
$reguser = $browser->addCustomUserAndLogin('reguser', 'evil');
$encoder = $browser->addCustomUserAndLogin('encoder', 'evil');
$browser->info('1 - New Loan screen')->get('/loan/new')->with('request')->begin()->isParameter('module', 'loan')->isParameter('action', 'new')->end()->info('1.1 - is everything ok on screen')->with('response')->begin()->isStatusCode(200)->checkElement('title', 'Add loan')->checkElement('.board_col', 1)->checkElement('.board_col .widget:first .widget_top_bar span', '/Loan/')->checkElement('.board_col .widget:nth-child(2) .widget_top_bar span', '/People involved/')->checkElement('.board_col .widget:nth-child(3) .widget_top_bar span', '/Loan status/')->checkElement('.board_col .widget:nth-child(4) .widget_top_bar span', '/Properties/')->checkElement('.board_col .widget:nth-child(5) .widget_top_bar span', '/Comments/')->checkElement('.board_col .widget:nth-child(6) .widget_top_bar span', '/Insurances/')->checkElement('.board_col .widget:nth-child(7) .widget_top_bar span', '/Related Files/')->checkElement('.board_col .widget:nth-child(8) .widget_top_bar span', '/Darwin Users/')->end()->click('#submit_loan', array('loans' => array('name' => 'loan for test', 'newActorsSender' => array(0 => array('people_ref' => $people->getId(), 'people_type' => 'sender', 'people_sub_type' => array(2), 'order_by' => 1)), 'newActorsReceiver' => array(0 => array('people_ref' => $people->getId(), 'people_type' => 'receiver', 'people_sub_type' => array(2, 4, 8), 'order_by' => 1)), 'newUsers' => array(0 => array('user_ref' => $reguser), 1 => array('user_ref' => $encoder, 'has_encoding_right' => 'on')))))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('response')->begin()->isStatusCode(200)->info('2 - Edition screen')->checkElement('title', 'Edit loan')->checkElement('.board_col .widget:nth-child(2) .widget_top_bar tbody#sender_body tr:first td:nth-child(4)', '/Chambert Yann/')->checkElement('.board_col .widget:nth-child(2) .widget_top_bar tbody#receiver_body tr:first td:nth-child(4)', '/Chambert Yann/')->end()->info('3 - Look for our new loan in search')->post('/loan/search', array('orderby' => 'name', 'orderdir' => 'desc', 'page' => 1, 'is_choose' => 0, 'loans_filters' => array('name' => 'loan for test')))->with('response')->begin()->checkElement('table.results tbody tr td:first', '/loan for test/')->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Index')->get('/lithostratigraphy/index')->with('request')->begin()->isParameter('module', 'lithostratigraphy')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('form#catalogue_filter table#search tbody td:first input#searchCatalogue_name', 1)->checkElement('form#catalogue_filter table#search tbody td:first input#searchCatalogue_table', 1)->checkElement('form#catalogue_filter table#search tbody td:nth-child(2) select#searchCatalogue_level_ref', 1)->checkElement('div.new_link', 1)->end()->info('Search without criterias')->click('.search_submit')->with('response')->begin()->isStatusCode(200)->checkElement('div[class="pager paging_info"] table tr td:nth-child(2)', '/8/')->checkElement('table.results tbody tr:nth-child(2) td:nth-child(3)', '/Invalid/')->end()->info('Edit this record')->click('table.results tbody tr:nth-child(2) td.edit a:nth-child(3)')->with('response')->begin()->isStatusCode(200)->setField('lithostratigraphy[name]', '')->setField('lithostratigraphy[level_ref]', '')->end()->click('Save')->with('form')->begin()->hasErrors(3)->isError('name', 'required')->isError('level_ref', 'required')->isError('color', 'required')->setField('lithostratigraphy[name]', 'Proutprout')->setField('lithostratigraphy[level_ref]', '65')->setField('lithostratigraphy[color]', '#ffffff')->end()->click('Save')->info('Test the record has been saved in DB');
$unit = Doctrine::getTable('lithostratigraphy')->findOneByName('Proutprout');
$browser->test()->is($unit->getName(), 'Proutprout', 'We have the new encoded unit');
$browser->info('Create a new record and save it then test its existence in DB')->get('lithostratigraphy/new')->with('response')->begin()->isStatusCode('200')->end()->click('Save', array('lithostratigraphy' => array('name' => 'Paxien', 'color' => '#ffffff', 'level_ref' => '66', 'parent_ref' => $unit->getId())));
$unit = Doctrine::getTable('lithostratigraphy')->findOneByName('Paxien');
$browser->test()->is($unit->getName(), 'Paxien', 'We have the new encoded unit');
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->get('/vernacularnames/vernacularnames?id=4&table=taxonomy')->with('response')->begin()->isStatusCode(200)->end()->click('Save', array('grouped_vernacular' => array('newVal' => array(0 => array('referenced_relation' => 'taxonomy', 'record_id' => '4', 'community' => '', 'name' => 'Test')))))->with('response')->begin()->isStatusCode(200)->end()->with('form')->begin()->hasErrors(1)->isError('newVal[0][community]', 'community')->end()->click('Save', array('grouped_vernacular' => array('newVal' => array(0 => array('referenced_relation' => 'taxonomy', 'record_id' => '4', 'community' => 'Français', 'name' => 'Faux con')))))->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end()->get('/vernacularnames/addValue?num=12')->with('response')->begin()->isStatusCode(200)->checkElement('tr', 1)->checkElement('tr td', 3)->end();
$r = Doctrine::getTable('VernacularNames')->findForTable('taxonomy', 4);
$browser->get('/vernacularnames/addValue?num=13&id=' . $r[0]->getId())->with('response')->begin()->isStatusCode(200)->checkElement('tr', 1)->checkElement('tr td', 3)->end();
Exemplo n.º 13
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Search')->get('/user/index')->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('.search_results_content')->checkElement('#users_filters_family_name')->end()->click('.search_submit', array('users_filters' => array('family_name' => array('text' => 'Evil'))))->with('response')->begin()->isStatusCode(200)->checkElement('.results_container')->checkElement('.results_container .results > tbody > tr', 1)->end()->get('/user/choose')->click('Search', array('users_filters' => array('family_name' => array('text' => 'sdf'))))->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/No Matching Items/', 'Content is ok');
$browser->info('Address')->get('/user/profile')->with('response')->begin()->isStatusCode(200)->checkElement('#address tbody tr', 0)->end()->click('#address a.link_catalogue')->with('response')->begin()->isStatusCode(200)->end()->click('Save')->with('response')->begin()->isStatusCode(200)->end()->with('form')->begin()->hasErrors(2)->isError('locality', 'required')->isError('country', 'required')->end()->click('Save', array('users_addresses' => array('locality' => 'Bruxelles', 'country' => 'Belgium', 'tag' => 'home,pref')))->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->get('/user/profile')->with('response')->begin()->isStatusCode(200)->checkElement('#address tbody tr', 1)->checkElement('#address tbody tr .tag', 2)->end()->click('#address table tbody a.link_catalogue')->with('response')->begin()->isStatusCode(200)->checkElement('input[value="Bruxelles"]')->end()->click('a.delete_button')->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->info('Comm')->get('/user/profile')->with('response')->begin()->isStatusCode(200)->checkElement('#comm tbody tr', 0)->end()->click('#comm a.link_catalogue')->with('response')->begin()->isStatusCode(200)->end()->click('Save')->with('response')->begin()->isStatusCode(200)->end()->with('form')->begin()->hasErrors(1)->isError('entry', 'required')->end()->click('Save', array('users_comm' => array('entry' => '+32478.254415', 'comm_type' => 'phone/fax', 'tag' => 'home')))->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->get('/user/profile')->with('response')->begin()->isStatusCode(200)->checkElement('#comm tbody tr', 1)->checkElement('#comm tbody tr .tag', 'Home')->end()->click('#comm table tbody a.link_catalogue')->with('response')->begin()->isStatusCode(200)->checkElement('input[value="+32478.254415"]')->end()->click('.delete_button')->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->get('/user/profile')->with('response')->begin()->isStatusCode(200)->end();
$browser->addCustomUserAndLogin('ychambert', 'toto');
$browser->addCustomUserAndLogin('encoder', 'evil');
$browser->addCustomUserAndLogin('manager', 'evil');
$browser->get('account/logout')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('user')->begin()->isAuthenticated(false)->end()->login('ychambert', 'toto');
$browser->info('Search')->get('/user/index')->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(403)->end();
$browser->info('Widget')->get('/user/widget')->with('response')->begin()->isStatusCode(200)->checkElement('tbody[alt="board_widget"] tr', 5)->end()->click('#submit', array('user_widget' => array('MyWidgets' => array(0 => array('category' => 'board_widget', 'group_name' => 'savedSearch', 'user_ref' => $id, 'widget_choice' => 'opened', 'title_perso' => 'Search'), 1 => array('category' => 'board_widget', 'group_name' => 'savedSpecimens', 'user_ref' => $id, 'widget_choice' => 'opened', 'title_perso' => 'Spec')))))->with('request')->begin()->isParameter('module', 'user')->isParameter('action', 'widget')->end();
$browser->info('users ychambert is not allowed to access to this page')->get('user/loginInfo?user_ref=' . Doctrine::getTable("Users")->findOneByFamilyName('Evil')->getId())->with('response')->begin()->isStatusCode(403)->end()->info('Prerences')->get('user/preferences')->with('response')->begin()->isStatusCode()->checkElement('h1', '/My Preferences/')->checkElement('.user_table > thead', 3)->checkElement('.user_table > tbody', 3)->checkElement('.user_table > tbody > tr', 6)->checkElement('#preferences_board_spec_rec_pp option[selected]', '10')->checkElement('#preferences_board_search_rec_pp option[selected]', '10')->end()->click('input[type="submit"]', array('preferences' => array('board_spec_rec_pp' => 5, 'board_search_rec_pp' => 5)))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('response')->begin()->isStatusCode()->checkElement('h1', '/My Preferences/')->checkElement('#preferences_board_spec_rec_pp option[selected]', '5')->checkElement('#preferences_board_search_rec_pp option[selected]', '5')->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
Doctrine_Query::create()->delete('informativeWorkflow')->execute();
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
/*$workflow = new informativeWorkflow() ;
$workflow->setStatus('suggestion') ;
$workflow->setReferencedRelation('specimens') ;
$workflow->setRecordId(1) ;
$workflow->setComment('change taxonomy for this specimen, use Falco peregrinus instead') ;
$workflow->save() ;*/
$browser->setHttpHeader('X_REQUESTED_WITH', 'XMLHttpRequest');
$browser->info('1 Add a workflow in a specimen with Ajax')->get('informativeWorkflow/add?table=specimens&id=1&status=suggestion&comment=change taxonomy for this specimen, use Falco peregrinus instead');
$browser->info('check if an informative workflow is present in taxonomy')->get('/taxonomy/edit?id=8')->with('response')->begin()->checkElement('#informativeWorkflow table.catalogue_table tbody td:nth-child(2)', 'To check')->checkElement('#informativeWorkflow table.catalogue_table tbody td:nth-child(3)', 'test de workflow pour les tests')->end();
$browser->info('check the workflow added with Ajax is present on board')->get('informativeWorkflow/search?status=all')->with('response')->begin()->checkElement('table.catalogue_table_view tbody td:nth-child(2)', 'specimens')->checkElement('table.catalogue_table_view tbody td:nth-child(3)', 'Suggestion')->checkElement('table.catalogue_table_view tbody td:nth-child(4)', 'change taxonomy for this sp...')->end();
Exemplo n.º 15
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Index')->get('/report/index')->with('response')->begin()->isStatusCode()->checkElement('h1', 'Reports')->checkElement('#report_list > option:first_element', '')->end();
Exemplo n.º 16
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Checks')->get('/synonym/checks?table=taxonomy&id=4&type=synonym')->with('response')->begin()->isStatusCode(200)->matches('/1/')->end()->get('/synonym/checks?table=taxonomy&id=5&type=isonym')->with('response')->begin()->isStatusCode(200)->matches('/0/')->end()->info('Add')->get('/synonym/add?table=taxonomy&id=4')->with('request')->begin()->isParameter('module', 'synonym')->isParameter('action', 'add')->end()->with('response')->begin()->isStatusCode(200)->checkElement('#syn_screen form.edition')->checkElement('#syn_screen form.edition')->checkElement('.merge_question')->checkElement('.search_box')->checkElement('#classification_synonymies_group_name option', 4)->end()->click('Save', array('classification_synonymies' => array('group_name' => 'synonym', 'order_by' => '0', 'merge' => '0', 'referenced_relation' => 'taxonomy')))->with('form')->begin()->hasErrors(2)->isError('merge', 'invalid')->isError('record_id', 'required')->end()->click('Save', array('classification_synonymies' => array('group_name' => 'synonym', 'order_by' => '0', 'record_id' => '2', 'merge' => '1', 'referenced_relation' => 'taxonomy')))->with('form')->begin()->hasErrors(false)->end()->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end();
$syn = Doctrine::getTable('ClassificationSynonymies')->findByGroupId(3);
$browser->test()->is(count($syn), 4, 'There are 4 synonyms');
$browser->info('Edit')->get('/widgets/reloadContent?widget=synonym&category=catalogue_taxonomy&eid=4')->with('response')->begin()->isStatusCode(200)->checkElement('table[alt="synonym"] tbody tr', 4)->checkElement('table[alt="synonym"] tbody tr:first td:contains(\'Duchesnus\')')->checkElement('table[alt="synonym"] tbody tr:last td:contains(\'eliticus\')')->checkElement('table[alt="synonym"] tbody tr:first .widget_row_delete img')->checkElement('table[alt="synonym"] tbody tr:last .widget_row_delete img', false)->end()->post('/synonym/editOrder?order=3,6,2,7,')->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end()->get('/widgets/reloadContent?widget=synonym&category=catalogue_taxonomy&eid=4')->with('response')->begin()->isStatusCode(200)->checkElement('table[alt="synonym"] tbody tr', 4)->checkElement('table[alt="synonym"] tbody tr:last td:contains(\'eliticus\')')->checkElement('table[alt="synonym"] tbody tr:first td:contains(\'recombinus\')')->checkElement('table[alt="synonym"] tbody tr.syn_id_2 .widget_row_delete img')->checkElement('table[alt="synonym"] tbody tr:first .widget_row_delete img', false)->end()->info('Delete')->get('/synonym/delete?table=taxonomy&id=3')->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end();
$syn = Doctrine::getTable('ClassificationSynonymies')->findByGroupId(3);
$browser->test()->is(count($syn), 3, 'One synonym is deleted');
Exemplo n.º 17
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Index')->get('/comment/comment?id=4&table=taxonomy')->with('request')->begin()->isParameter('module', 'comment')->isParameter('action', 'comment')->end()->with('response')->begin()->isStatusCode(200)->checkElement('.delete_button', false)->checkElement('textarea', '')->end()->click('Save', array('comments' => array('referenced_relation' => 'taxonomy', 'record_id' => '4', 'notion_concerned' => 'taxon life history', 'comment' => 'This is ok...
There is a thing')))->with('request')->begin()->isParameter('module', 'comment')->isParameter('action', 'comment')->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$item = Doctrine_Query::create()->from('Comments c')->andWhere("c.referenced_relation = 'taxonomy'")->andWhere("c.notion_concerned = 'taxon life history' ")->andWhere('c.record_id=4')->fetchOne();
$browser->test()->isnt($item, null, 'We add an item');
$browser->info('Update')->get('/comment/comment?id=4&table=taxonomy&cid=' . $item->getId())->with('request')->begin()->isParameter('module', 'comment')->isParameter('action', 'comment')->end()->with('response')->begin()->isStatusCode(200)->checkElement('.delete_button')->checkElement('textarea', '/There is a thing/')->end()->click('Save', array('comments' => array('referenced_relation' => 'taxonomy', 'record_id' => '4', 'notion_concerned' => 'taxon life history', 'comment' => 'This is not ok...')))->with('request')->begin()->isParameter('module', 'comment')->isParameter('action', 'comment')->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->get('/comment/comment?id=4&table=taxonomy&cid=' . $item->getId())->with('request')->begin()->isParameter('module', 'comment')->isParameter('action', 'comment')->end()->with('response')->begin()->isStatusCode(200)->checkElement('.delete_button')->checkElement('textarea', 'This is not ok...')->end()->info('Delete')->click('.delete_button')->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$item = Doctrine_Query::create()->from('Comments c')->andWhere("c.referenced_relation = 'taxonomy'")->andWhere("c.notion_concerned = 'taxon life history' ")->andWhere('c.record_id=4')->fetchOne();
$browser->test()->is($item, null, 'there is no more item');
Exemplo n.º 18
0
<?php

// test/bootstrap/Doctrine.php
include dirname(__FILE__) . '/unit.php';
$configuration = ProjectConfiguration::getApplicationConfiguration('backend', 'test', true);
new sfDatabaseManager($configuration);
DarwinTestFunctional::initiateDB();
Doctrine::loadData(sfConfig::get('sf_test_dir') . '/fixtures');
Exemplo n.º 19
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$col = Doctrine::getTable('Collections')->findOneByName('Import collection')->getId();
$task = new darwinCheckImportTask($configuration->getEventDispatcher(), new sfFormatter());
$browser->info('Import Index')->get('/import/index')->with('request')->begin()->isParameter('module', 'import')->isParameter('action', 'index')->end()->with('response')->begin()->checkElement('h1', 'Imports : ')->end()->click('input.search_submit')->with('response')->begin()->checkElement('table.results tbody tr td:nth-child(2)', 'Import collection')->end()->info('Staging Index')->get('/staging/edit/id/1')->with('request')->begin()->isParameter('module', 'staging')->isParameter('action', 'edit')->end()->with('response')->begin()->checkElement('input[id="staging_taxon_ref_name"][value="Cacaleluya"]')->end()->info('Correct the taxon error')->click("#submit", array('staging' => array('taxon_ref' => 11)))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'staging')->isParameter('action', 'index')->end()->info('Look in search if it remain just one problem between the 3 lines')->post('/staging/search/import/1')->with('response')->begin()->checkElement('table.staging_table tbody td.fld_tocomplete:first', 1)->end()->info('Mark The 2 good lines as ok')->get('/staging/markok?import=1')->with('request')->begin()->isParameter('module', 'staging')->isParameter('action', 'markok')->end();
$task->run(array(), array('--application=backend', '--do-import'));
$browser->info('check if just one record is imported (because the second is linked to the remaining one with error)')->get('/import/index')->click('input.search_submit')->with('response')->begin()->checkElement('table.results tbody tr td:nth-child(6)', '/1 on 3/')->end()->post('/staging/search/import/1')->with('response')->begin()->checkElement('table.staging_table tbody tr', 1)->end()->info("let's correct the second record to import both")->get('/staging/edit/id/2')->with('request')->begin()->isParameter('module', 'staging')->isParameter('action', 'edit')->end()->with('response')->begin()->checkElement('input[id="staging_WrongPeople_0_people_ref_name"][value="Poilux"]')->end()->info('Correct the people error')->click("#submit", array('staging' => array('WrongPeople' => array(array('people_ref' => Doctrine::getTable('People')->findOneByGivenName('Poilux')->getId())))))->with('response')->begin()->isRedirected()->end()->post('/staging/search/import/1')->with('response')->begin()->checkElement('table.staging_table tbody tr:first td:nth-child(3)', '/No problems detected/')->end()->get('/staging/markok?import=1')->with('request')->begin()->end();
$task->run(array(), array('--application=backend', '--do-import'));
$browser->info('check if all the 3 records were well imported now')->post('/specimensearch/search', array('specimen_search_filters' => array('collection_ref' => array(0 => $col))))->with('response')->begin()->isStatusCode()->checkElement('table.spec_results tbody tr', 3)->end()->info('Ensure the import is finished (and so doesn\'t appear in search anymore)')->get('/import/index')->with('request')->begin()->isParameter('module', 'import')->isParameter('action', 'index')->end()->with('response')->begin()->checkElement('h1', 'Imports : ')->end()->click('input.search_submit', array('imports_filters' => array('show_finished' => true)))->with('response')->begin()->checkElement('table.results tbody tr', 1)->checkElement('table.results tbody tr td:nth-child(4)', '/Finished/')->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->get('/cataloguepeople/people?table=taxonomy&rid=3')->with('request')->begin()->isParameter('module', 'cataloguepeople')->isParameter('action', 'people')->end()->with('response')->begin()->isStatusCode(200)->checkElement('form')->checkElement('#catalogue_people_people_type option', 2)->checkElement('.tab_choice li', 2)->end()->click('Save')->with('form')->begin()->hasErrors(1)->isError('people_ref', 'required')->end();
$people = Doctrine::getTable('People')->findOneByFamilyName('Root');
$browser->click('Save', array('catalogue_people' => array('people_type' => 'expert', 'people_sub_type' => 'Main', 'record_id' => '3', 'people_ref' => $people->getId(), 'referenced_relation' => 'taxonomy')))->with('form')->begin()->hasErrors(0)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$rbins = Doctrine::getTable('People')->findOneByFamilyName('Institut Royal des Sciences Naturelles de Belgique');
$rbins->save();
$browser->get('/cataloguepeople/people?table=taxonomy&rid=3')->click('Save', array('catalogue_people' => array('people_type' => 'author', 'people_sub_type' => 'Main', 'record_id' => '3', 'people_ref' => $rbins->getId(), 'referenced_relation' => 'taxonomy')))->with('form')->begin()->hasErrors(0)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->get('/widgets/reloadContent?widget=cataloguePeople&category=catalogue_taxonomy&eid=3')->with('response')->begin()->isStatusCode(200)->checkElement('table tr:nth-child(1) .widget_sub_table tbody tr', 2)->checkElement('table tr:nth-child(1) .widget_sub_table tbody tr:first td:nth-child(2)', '/Root/')->checkElement('table tr:nth-child(1) .widget_sub_table tbody tr:last td:nth-child(2)', '/Institut Royal des Sciences Naturelles de Belgique/')->end();
$rbins_recId = Doctrine_Query::create()->from('CataloguePeople c')->where('c.people_ref = ?', $rbins->getId())->andWhere('c.people_type=?', 'author')->fetchOne();
$root_recId = Doctrine_Query::create()->from('CataloguePeople c')->where('c.people_ref = ?', $people->getId())->andWhere('c.people_type=?', 'author')->fetchOne();
$browser->get('/cataloguepeople/editOrder?table=taxonomy&rid=3&people_type=author&order=' . $rbins_recId->getId() . ',' . $root_recId->getId() . ',')->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/ok/', 'Content is ok');
$browser->get('/widgets/reloadContent?widget=cataloguePeople&category=catalogue_taxonomy&eid=3')->with('response')->begin()->isStatusCode(200)->checkElement('table tr:nth-child(1) .widget_sub_table tbody tr', 2)->checkElement('table tr:nth-child(1) .widget_sub_table tbody tr:first td:nth-child(2)', '/Institut Royal des Sciences Naturelles de Belgique/')->checkElement('table tr:nth-child(1) .widget_sub_table tbody tr:last td:nth-child(2)', '/Root/')->end();
$browser->get('/cataloguepeople/getSubType?type=author')->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/Secondary Author/', 'Content is ok');
$browser->test()->like($browser->getResponse()->getContent(), '/Corrector/', 'Content is ok');
$browser->get('/cataloguepeople/getSubType?type=expert')->with('response')->begin()->isStatusCode(200)->end();
$browser->test()->like($browser->getResponse()->getContent(), '/Main/', 'Content is ok');
Exemplo n.º 21
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->get('/property/add?id=4&table=taxonomy')->with('response')->begin()->isStatusCode(200)->checkElement('#properties_property_type option', 3)->checkElement('#properties_applies_to option', 2)->checkElement('#properties_property_unit option', 2)->end()->click('Save', array('properties' => array('referenced_relation' => 'taxonomy', 'record_id' => '4', 'property_type' => '', 'applies_to' => '', 'date_from' => '', 'date_to' => '', 'method' => '', 'property_accuracy' => '', 'property_unit' => '')))->with('form')->begin()->hasErrors(1)->isError('property_type', 'required')->end()->click('Save', array('properties' => array('referenced_relation' => 'taxonomy', 'record_id' => '4', 'property_type' => 'size', 'date_from' => '', 'date_to' => '', 'method' => '', 'property_unit' => 'm²', 'lower_value' => '12', 'property_accuracy' => '10')))->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end()->get('/property/getUnit?type=size')->with('response')->begin()->isStatusCode(200)->checkElement('option', 2)->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('1 - AcquisitionCategories')->get('/widgets/reloadContent?widget=acquisitionCategory&category=specimen')->with('response')->begin()->isStatusCode(200)->checkElement('select', 4)->checkElement('select:first option', 13)->checkElement('select:first option:first', 'Undefined')->end()->info('2 - CollectionRef')->get('/widgets/reloadContent?widget=refCollection&category=specimen')->with('response')->begin()->isStatusCode(200)->checkElement('input[type="hidden"]', 1)->end()->get('/widgets/reloadContent?widget=tool&category=specimen')->with('response')->begin()->isStatusCode(200)->checkElement('#unassociated_specimen_collecting_tools_list option', 2)->checkElement('#associated_specimen_collecting_tools_list option', 0)->end()->get('/widgets/reloadContent?widget=method&category=specimen')->with('response')->begin()->isStatusCode(200)->checkElement('#unassociated_specimen_collecting_methods_list option', 2)->checkElement('#associated_specimen_collecting_methods_list option', 0)->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Index')->get('/mineralogy/index')->with('request')->begin()->isParameter('module', 'mineralogy')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('form#catalogue_filter table#search tbody td:first ul li input#searchCatalogue_code', 1)->checkElement('form#catalogue_filter table#search tbody td:nth-child(2) input#searchCatalogue_name', 1)->checkElement('form#catalogue_filter table#search tbody td:nth-child(2) input#searchCatalogue_table', 1)->checkElement('form#catalogue_filter table#search tbody td:nth-child(3) select#searchCatalogue_classification', 1)->checkElement('form#catalogue_filter table#search tbody td:nth-child(4) select#searchCatalogue_level_ref', 1)->checkElement('div.new_link', 1)->end()->info('Search with Dana classification -> no records encoded')->post('/catalogue/search/', array('searchCatalogue' => array('table' => 'mineralogy', 'classification' => 'dana')))->with('response')->begin()->isStatusCode(200)->matches('/no matching items/i')->end()->info('Search without criterias')->get('/mineralogy/index')->with('response')->begin()->isStatusCode('200')->end()->click('.search_submit')->with('response')->begin()->isStatusCode(200)->checkElement('div[class="pager paging_info"] table tr td:nth-child(2)', '/11/')->checkElement('table.results tbody tr:first td:nth-child(4)', '/Invalid/')->end()->info('Edit invalid record')->click('table.results tbody tr:first td.edit a:nth-child(3)')->with('response')->begin()->isStatusCode(200)->setField('mineralogy[code]', '')->setField('mineralogy[name]', '')->setField('mineralogy[level_ref]', '')->setField('mineralogy[classification]', '')->end()->click('Save')->with('form')->begin()->hasErrors(5)->isError('code', 'required')->isError('name', 'required')->isError('level_ref', 'required')->isError('classification', 'required')->isError('color', 'required')->setField('mineralogy[code]', '5.AA')->setField('mineralogy[name]', 'Proutprout')->setField('mineralogy[level_ref]', '72')->setField('mineralogy[classification]', 'Bouc')->setField('mineralogy[color]', '#555555')->end()->click('Save')->with('form')->begin()->hasErrors(1)->isError('classification', 'invalid')->setField('mineralogy[classification]', 'strunz')->end()->click('Save')->info('Test the record has been saved in DB');
$unit = Doctrine::getTable('mineralogy')->findOneByName('Proutprout');
$browser->test()->is($unit->getName(), 'Proutprout', 'We have the modified unit');
$browser->info('Create a new record and save it then test its existence in DB')->get('mineralogy/new')->with('response')->begin()->isStatusCode('200')->end()->click('Save', array('mineralogy' => array('code' => '5.AAH', 'color' => '#554554', 'name' => 'Paxien', 'level_ref' => '73', 'parent_ref' => $unit->getId())));
$unit = Doctrine::getTable('mineralogy')->findOneByName('Paxien');
$browser->test()->is($unit->getName(), 'Paxien', 'We have the new encoded unit');
Exemplo n.º 24
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration);
$browser->info('1 - Not Logged Request')->get('/board/index')->with('request')->begin()->isParameter('module', 'board')->isParameter('action', 'index')->isForwardedTo('account', 'login')->end()->with('response')->begin()->isStatusCode(200)->end()->with('user')->begin()->isAuthenticated(false)->end()->info('2 - Test bad login and password')->click('Log in', array('login' => array('username' => 'brol', 'password' => 'brol')))->with('form')->begin()->hasErrors(true)->end()->info('3 - Test good login but bad password')->click('Log in', array('login' => array('username' => 'root', 'password' => 'brol')))->with('form')->begin()->hasErrors(true)->end()->info('4 - Test good login and password')->click('Log in', array('login' => array('username' => 'root', 'password' => 'evil')))->with('form')->begin()->hasErrors(false)->end()->with('response')->begin()->isRedirected()->end()->followRedirect()->followRedirect()->with('request')->begin()->isParameter('module', 'board')->isParameter('action', 'index')->end()->with('user')->begin()->isAuthenticated(true)->end()->info('5 - Logout')->click('Exit')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('user')->begin()->isAuthenticated(false)->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$vernacular_names = new VernacularNames();
$vernacular_names->setCommunity('French');
$vernacular_names->setReferencedRelation('taxonomy');
$vernacular_names->setRecordId(4);
$vernacular_names->name = 'Faux con';
$vernacular_names->save();
$personId = Doctrine::getTable('People')->findOneByFamilyNameAndGivenName('Root', 'Evil')->getId();
$catalogue_people = new CataloguePeople();
$catalogue_people->setReferencedRelation('taxonomy');
$catalogue_people->setRecordId(4);
$catalogue_people->setPeopleType('authors');
$catalogue_people->setPeopleSubType('Main authors');
$catalogue_people->setPeopleRef($personId);
$catalogue_people->save();
$browser->info('2 - Recombined')->get('/widgets/reloadContent?widget=relationRecombination&category=catalogue_taxonomy&eid=4')->with('response')->begin()->isStatusCode(200)->checkElement('table tbody tr', 1)->checkElement('table tbody tr td:first a.link_catalogue', '/recombinus/')->checkElement('img', 3)->end();
$items = Doctrine::getTable('CatalogueRelationships')->getRelationsForTable('taxonomy', 4, 'current_name');
$browser->get('/catalogue/deleteRelated?table=catalogue_relationships&id=' . $items[0]['id'])->with('response')->begin()->isStatusCode(200)->end();
$browser->info('3 - Comment')->get('/widgets/reloadContent?widget=comment&category=catalogue_taxonomy&eid=4')->with('response')->begin()->isStatusCode(200)->checkElement('table tr', 2)->checkElement('table tr:last a.link_catalogue', '/taxon information/')->checkElement('table tr:last td:nth-child(2)', '/This is bullshit/')->end()->info('4 - Properties')->get('/widgets/reloadContent?widget=properties&category=catalogue_taxonomy&eid=4')->with('response')->begin()->isStatusCode(200)->checkElement('table tbody tr', 2)->checkElement('table tbody tr:first td:first', '/physical measurement/')->checkElement('table tbody tr:last td:first', '/protection status/')->end()->info('5 - Vernacular Names')->get('/widgets/reloadContent?widget=vernacularNames&category=catalogue_taxonomy&eid=4')->with('response')->begin()->isStatusCode(200)->checkElement('table tbody tr', 1)->checkElement('table tbody tr:first td:first', '/French/')->checkElement('table tbody tr:first td::nth-child(2)', '/Faux con/')->end()->info('6 - Synonymies')->get('/widgets/reloadContent?widget=synonym&category=catalogue_taxonomy&eid=4')->with('response')->begin()->isStatusCode(200)->checkElement('table.catalogue_table tbody table[alt="homonym"]', 1)->checkElement('table.catalogue_table tbody table[alt="synonym"]', 1)->checkElement('table.catalogue_table tbody table[alt="synonym"] tbody tr', 2)->checkElement('table.catalogue_table tbody table[alt="synonym"] tbody td:first[class="handle"]', 1)->checkElement('table.catalogue_table tbody table[alt="synonym"] tbody td:nth-child(2)', '/Duchesnus Brulus 1912/')->checkElement('table.catalogue_table tbody table[alt="synonym"] tbody tr:first td:nth-child(3)[class="basio_cell"]', 1)->checkElement('table.catalogue_table tbody table[alt="synonym"] tbody tr:first td:nth-child(4)[class="widget_row_delete"]', 1)->end();
$items = Doctrine::getTable('ClassificationSynonymies')->findOneByReferencedRelationAndRecordId('taxonomy', 4);
$browser->info('8 - Synonymies after a delete')->get('/synonym/delete?id=' . $items['id'])->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end()->get('/widgets/reloadContent?widget=synonym&category=catalogue_taxonomy&eid=4')->with('response')->begin()->isStatusCode(200)->checkElement('table.catalogue_table tbody table[alt="homonym"]', 1)->checkElement('table.catalogue_table tbody table[alt="synonym"]', 0)->end()->info('9 - People related')->get('/widgets/reloadContent?widget=cataloguePeople&category=catalogue_taxonomy&eid=4')->with('response')->begin()->isStatusCode(200)->checkElement('table[class="widget_sub_table"] tbody td:first[class="handle"]', 1)->checkElement('table[class="widget_sub_table"] tbody td:nth-child(2)', '/Root Evil/')->checkElement('table[class="widget_sub_table"] tbody td:nth-child(3)[class="catalogue_people_sub_type"]', 1)->checkElement('table[class="widget_sub_table"] tbody td:last[class="widget_row_delete"]', 1)->end()->click('table[class="widget_sub_table"] tbody td:last[class="widget_row_delete"] > a')->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end()->get('/widgets/reloadContent?widget=cataloguePeople&category=catalogue_taxonomy&eid=4')->with('response')->begin()->isStatusCode(200)->checkElement('table[class="widget_sub_table"]', 0)->end();
Exemplo n.º 26
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Index')->get('/igs/index')->with('response')->begin()->isStatusCode()->checkElement('h1', 'General Inventory Numbers Search')->checkElement('#searchIg_ig_num', '')->checkElement('#searchIg_from_date_day > option:first_element', 'dd')->checkElement('#searchIg_from_date_month > option:first_element', 'mm')->checkElement('#searchIg_from_date_year > option:first_element', 'yyyy')->checkElement('#searchIg_to_date_day > option:first_element', 'dd')->checkElement('#searchIg_to_date_month > option:first_element', 'mm')->checkElement('#searchIg_to_date_year > option:first_element', 'yyyy')->checkElement('form input[type="submit"]', 1)->setField('#searchIg_from_date_month', '10')->end()->info('Post waiting for a "Year missing" error')->post('/igs/search', array('searchIg' => array('from_date' => array('month' => 10))))->with('response')->begin()->isStatusCode()->checkElement('.error_list li', 'Year missing.')->end()->info('Post waiting for a "Month missing" error')->post('/igs/search', array('searchIg' => array('from_date' => array('day' => 2, 'year' => 1975))))->with('response')->begin()->isStatusCode()->checkElement('.error_list li', 'Month missing or remove the day and time.')->end()->info('Post waiting for the full results table and the pager')->post('/igs/search', array('is_choose' => 0, 'searchIg' => array('ig_num' => '', 'from_date' => '', 'to_date' => '')))->with('response')->begin()->isStatusCode()->checkElement('ul.pager_nav li', 10)->checkElement('ul.pager_nav li.page_selected', '[1]')->checkElement('.pager li a span.nav_arrow', 0)->checkElement('div.paging_info table td:nth-child(2)', 1)->checkElement('div.paging_info table td:last-child select[id="searchIg_rec_per_page"]', 1)->checkElement('table.results tbody tr', 7)->checkElement('table.results thead th:first_element a.sort span.order_sign_down')->end()->info('Click to sort on name descending...')->post('/igs/search', array('orderby' => 'ig_num', 'orderdir' => 'desc', 'page' => 1, 'is_choose' => 0, 'searchIg' => array('ig_num' => '', 'from_date' => '', 'to_date' => '')))->with('response')->begin()->checkElement('table.results thead th:first_element a.sort span.order_sign_up')->end()->info('Select a number of 5 records per pages and test existence of links in pager')->post('/igs/search', array('orderby' => 'ig_num', 'orderdir' => 'desc', 'page' => 1, 'is_choose' => 0, 'searchIg' => array('rec_per_page' => 5, 'ig_num' => '', 'from_date' => '', 'to_date' => '')))->with('response')->begin()->checkElement('.pager_nav .pager_separator')->checkElement('.pager_nav li a span.nav_arrow', 4)->checkElement('table.results tbody tr', 5)->end()->info('Select page 2')->post('/igs/search', array('orderby' => 'ig_num', 'orderdir' => 'desc', 'page' => 2, 'is_choose' => 0, 'searchIg' => array('rec_per_page' => 5, 'ig_num' => '', 'from_date' => '', 'to_date' => '')))->with('response')->begin()->checkElement('.pager .pager_separator')->checkElement('ul.pager_nav li.page_selected', '[2]')->checkElement('.pager_nav li a span.nav_arrow', 4)->checkElement('table.results tbody tr', 2)->end()->info('Search on IG num "26" like')->post('/igs/search', array('orderby' => 'ig_num', 'orderdir' => 'desc', 'page' => 1, 'is_choose' => 0, 'searchIg' => array('ig_num' => '26', 'from_date' => '', 'to_date' => '')))->with('response')->begin()->checkElement('table.results tbody tr', 4)->end()->info('Search on IG from 1900')->post('/igs/search', array('orderby' => 'ig_num', 'orderdir' => 'desc', 'page' => 1, 'is_choose' => 0, 'searchIg' => array('ig_num' => '', 'from_date' => array('day' => '', 'month' => '', 'year' => '1900'), 'to_date' => '')))->with('response')->begin()->checkElement('table.results tbody tr', 1)->end()->info('Search on IG from 01/01/1877')->post('/igs/search', array('orderby' => 'ig_num', 'orderdir' => 'desc', 'page' => 1, 'is_choose' => 0, 'searchIg' => array('ig_num' => '', 'from_date' => array('day' => '01', 'month' => '01', 'year' => '1877'), 'to_date' => '')))->with('response')->begin()->checkElement('table.results tbody tr', 2)->end()->info('Search on IG num up to 01/01/1878')->post('/igs/search', array('orderby' => 'ig_num', 'orderdir' => 'desc', 'page' => 1, 'is_choose' => 0, 'searchIg' => array('ig_num' => '', 'to_date' => array('day' => '01', 'month' => '01', 'year' => '1878'), 'from_date' => '')))->with('response')->begin()->checkElement('table.results tbody tr', 3)->end()->info('Get new record')->get('/igs/index')->click('New')->with('response')->begin()->isStatusCode()->checkElement('h1', 'New I.G. number')->checkElement('h1[class="edit_mode"]', true)->checkElement('form[class="edition"]', true)->checkElement('#igs_ig_date_day > option:first_element', 'dd')->checkElement('#igs_ig_date_month > option:first_element', 'mm')->checkElement('#igs_ig_date_year > option:first_element', 'yyyy')->checkElement('form a', 'Cancel')->checkElement('form input[type="submit"][value="Save"]', 1)->end()->info('Try to save without data')->click('Save', array('igss' => array('ig_num' => '', 'ig_date' => '')))->with('form')->begin()->hasErrors(1)->isError('ig_num', 'required')->end()->info('Try to save with only "Year missing" error')->click('Save', array('igs' => array('ig_num' => 'Pollux', 'ig_date' => array('day' => '', 'month' => '05', 'year' => ''))))->with('form')->begin()->hasErrors(1)->isError('ig_date', 'year_missing')->end()->info('Try to save with only "Month missing" error')->click('Save', array('igs' => array('ig_num' => 'Pollux', 'ig_date' => array('day' => '05', 'month' => '', 'year' => '2000'))))->with('form')->begin()->hasErrors(1)->isError('ig_date', 'month_missing')->end()->info('Save with correct data and check everything was saved correctly')->click('Save', array('igs' => array('ig_num' => 'Pollux', 'ig_date' => array('day' => '05', 'month' => '12', 'year' => '2000'))))->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'igs')->isParameter('action', 'edit')->end()->with('response')->begin()->checkElement('form input[name="igs[ig_num]"][value="Pollux"]', 1)->checkElement('form table tfoot a:first', 'New I.G.')->checkElement('form table tfoot a:nth-child(4)', 'Cancel')->checkElement('form table tfoot a:nth-child(5)', 'Delete')->checkElement('li[class="widget"][id="comment"]', 1)->checkElement('li[class="widget"][id="comment"] div[class="widget_content hidden"]', 1)->checkElement('li[class="widget"][id="insurances"]', 1)->checkElement('li[class="widget"][id="insurances"] div[class="widget_content hidden"]', 1)->end();
$items = Doctrine::getTable('Igs')->findByIgNum('Pollux');
$browser->info('Check new record has been saved in DB')->test()->is($items[0]->getIgNum(), 'Pollux', 'We have the new encoded IG');
$browser->test()->is($items[0]->getIgDate(), array('year' => 2000, 'month' => 12, 'day' => 5, 'hour' => '', 'minute' => '', 'second' => ''), 'We have the new encoded IG');
$browser->info('Test the delete action...')->get('/igs/edit/id/' . $items[0]->getId())->click('Delete')->with('response')->begin()->isRedirected()->end()->followRedirect()->with('request')->begin()->isParameter('module', 'igs')->isParameter('action', 'index')->end();
$items = Doctrine::getTable('Igs')->findByIgNum('Pollux');
$browser->test()->is($items->count(), 0, 'IG well deleted');
Exemplo n.º 27
0
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('1 - GetBoard')->get('/board/index')->with('request')->begin()->isParameter('module', 'board')->isParameter('action', 'index')->end()->info('1.1 - is everything ok on the board')->with('response')->begin()->isStatusCode(200)->checkElement('title', 'Dashboard')->checkElement('.board_col', 2)->checkElement('.board_col:first .widget', 2)->checkElement('.board_col:last .widget', 4)->checkElement('.board_col:first .widget:first .widget_top_bar span', '/My saved specimens/')->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Index')->get('/collection/index')->with('request')->begin()->isParameter('module', 'collection')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('h1', 'Collection List')->checkElement('h2:last', 'UGMM')->checkElement('.treelist:first > ul > li', 2)->checkElement('.treelist:first > ul > li:nth-child(2) span', '/Vertebrates/')->checkElement('.treelist:first > ul > li:nth-child(2) a img')->checkElement('.treelist:first > ul > li:nth-child(2) > ul > li', 2)->checkElement('.treelist:first > ul > li:nth-child(2) > ul > li:first span', '/Amphibia/')->checkElement('.treelist:last > ul > li', 1)->end()->info('New')->get('/collection/new')->with('request')->begin()->isParameter('module', 'collection')->isParameter('action', 'new')->end()->with('response')->begin()->isStatusCode(200)->end()->click('Save', array('collections' => array('name' => '', 'institution_ref' => '', 'collection_type' => '', 'code' => '', 'main_manager_ref' => '', 'parent_ref' => '')))->with('form')->begin()->hasErrors(5)->isError('name', 'required')->isError('code', 'required')->isError('institution_ref', 'required')->isError('collection_type', 'required')->isError('main_manager_ref', 'required')->end()->with('request')->begin()->isParameter('module', 'collection')->isParameter('action', 'create')->end()->click('Save', array('collections' => array('name' => 'Paléonotologie', 'institution_ref' => Doctrine::getTable('People')->findOneByFamilyName('Institut Royal des Sciences Naturelles de Belgique')->getId(), 'collection_type' => 'mix', 'code' => 'paleo', 'main_manager_ref' => Doctrine::getTable('Users')->findOneByFamilyName('Evil')->getId(), 'parent_ref' => '')))->followRedirect()->with('request')->begin()->isParameter('module', 'collection')->isParameter('action', 'edit')->end()->with('response')->begin()->isStatusCode(200)->end()->get('/collection/index')->info('Edit')->click('.treelist:first > ul > li:nth-child(3) > ul > li:nth-child(2) div a', array())->with('request')->begin()->isParameter('module', 'collection')->isParameter('action', 'edit')->end()->with('response')->begin()->isStatusCode(200)->checkElement('input[value="Aves"]')->end()->get('/collection/index')->with('response')->begin()->isStatusCode(200)->checkElement('.treelist:first > ul > li', 3)->checkElement('.treelist:last > ul > li', 1)->end()->info('Delete')->click('.col_name:eq(5) > a:first')->with('request')->begin()->isParameter('module', 'collection')->isParameter('action', 'edit')->end()->click('Delete')->followRedirect()->with('request')->begin()->isParameter('module', 'collection')->isParameter('action', 'index')->end()->with('response')->begin()->isStatusCode(200)->checkElement('.treelist:first > ul > li', 3)->end();
$user_id = $browser->addCustomUserAndLogin();
$collection_id = Doctrine::getTable('Collections')->getCollectionByName('Vertebrates')->getId();
$browser->info('sub collection right')->get('collection/rights/user_ref/' . $user_id . '/collection_ref/' . $collection_id)->with('request')->begin()->isParameter('module', 'collection')->isParameter('action', 'rights')->end()->with('response')->begin()->isStatusCode(200)->checkElement('.treelist:first > ul > li:first span', '/Amphibia/')->end()->click('Save', array('sub_collection' => array('SubCollectionsRights' => array(0 => array('user_ref' => $user_id, 'collection_ref' => Doctrine::getTable('Collections')->getCollectionByName('Amphibia')->getId(), 'check_right' => true), 1 => array('user_ref' => $user_id, 'collection_ref' => Doctrine::getTable('Collections')->getCollectionByName('Aves')->getId(), 'check_right' => false)))));
$browser->info('sub collection right')->get('collection/edit/id/' . Doctrine::getTable('collections')->getCollectionByName('Amphibia')->getId())->with('request')->begin()->isParameter('module', 'collection')->isParameter('action', 'edit')->end()->get('collection/edit/id/' . Doctrine::getTable('collections')->getCollectionByName('Aves')->getId())->with('request')->begin()->isParameter('module', 'collection')->isParameter('action', 'edit')->end()->with('response')->begin()->isStatusCode(200)->checkElement('#' . $user_id, null)->end();
$vertebrates = Doctrine::getTable('Collections')->findOneByName('Vertebrates');
$vertId = $vertebrates->getId();
$browser->info('Get vertebrate collection for specimen codes default values check')->get('collection/edit', array('id' => $vertId))->with('response')->begin()->isStatusCode(200)->checkElement('li#collectionsCodes div.widget_content table tbody tr', 1)->checkElement('li#collectionsCodes div.widget_content table tbody tr td', 10)->checkElement('li#collectionsCodes div.widget_content table tbody tr td:first', '/VERT./')->checkElement('li#collectionsCodes div.widget_content table tbody tr td:nth-child(9) a.link_catalogue', 1)->checkElement('li#collectionsCodes div.widget_content table tbody tr td:last a.widget_row_delete', 1)->end()->click('li#collectionsCodes div.widget_content table tbody tr td:nth-child(9) a.link_catalogue')->with('response')->begin()->isStatusCode(200)->checkElement('div#collections_codes_screen form#collections_codes_form', 1)->checkElement('div#collections_codes_screen form#collections_codes_form table tbody tr', 9)->checkElement('div#collections_codes_screen form#collections_codes_form table tbody tr:nth-child(2) td input#collections_code_prefix', 1)->checkElement('div#collections_codes_screen form#collections_codes_form table tbody tr:nth-child(3) td input#collections_code_prefix_separator', 1)->checkElement('div#collections_codes_screen form#collections_codes_form table tbody tr:nth-child(4) td input#collections_code_suffix_separator', 1)->checkElement('div#collections_codes_screen form#collections_codes_form table tbody tr:nth-child(5) td input#collections_code_suffix', 1)->checkElement('div#collections_codes_screen form#collections_codes_form table tbody tr:nth-child(6) td input#collections_code_auto_increment', 1)->checkElement('div#collections_codes_screen form#collections_codes_form table tbody tr:nth-child(7) td input#collections_code_auto_increment_for_insert_only', 1)->checkElement('div#collections_codes_screen form#collections_codes_form table tbody tr:nth-child(8) td input#collections_code_specimen_duplicate', 1)->checkElement('div#collections_codes_screen form#collections_codes_form table tbody tr:nth-child(9) td input#collections_code_mask', 1)->end()->click('a.delete_button')->with('response')->begin()->isStatusCode(200)->matches('/ok/')->end();
$vertebrates = Doctrine::getTable('Collections')->findOneByName('Vertebrates');
$browser->test()->is($vertebrates->getCodePrefix(), '', 'The code prefix has been well reset');
$collection_id = $browser->addCustomCollection('12345', 'Collection for test');
$browser->info('test if the two collector exist')->get('collection/edit?id=' . $collection_id)->with('response')->begin()->isStatusCode(200)->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('1 - SavedSearch')->get('/widgets/reloadContent?widget=savedSearch&category=board')->with('response')->begin()->isStatusCode(200)->checkElement('.saved_searches_board', 1)->checkElement('.saved_searches_board img.favorite_off.hidden', 1)->checkElement('.saved_searches_board img.favorite_on.hidden', 1)->checkElement('.saved_searches_board tr:first img.favorite_on', 1)->end();
<?php

include dirname(__FILE__) . '/../../bootstrap/functional.php';
$browser = new DarwinTestFunctional(new sfBrowser());
$browser->loadData($configuration)->login('root', 'evil');
$browser->info('Save Search Page')->get('/savesearch/index')->with('response')->begin()->isStatusCode()->checkElement('h1', 'My saved searches')->checkElement('table.saved_searches')->checkElement('table.saved_searches tbody tr', 2)->checkElement('table.saved_searches tbody tr div.search_name', 2)->checkElement('table.saved_searches tbody tr div.date', 2)->checkElement('table.saved_searches tbody tr:first div.search_name', '/All specimens encoded by me/')->checkElement('table.saved_searches tbody tr:first .favorite_off.hidden')->end()->info('Save Specimen Page')->get('/savesearch/index?specimen=1')->with('response')->begin()->isStatusCode()->checkElement('h1', 'My saved specimens')->checkElement('table.saved_searches')->checkElement('table.saved_searches tbody tr', 1)->checkElement('table.saved_searches tbody tr div.search_name', 1)->checkElement('table.saved_searches tbody tr div.date', 1)->checkElement('table.saved_searches tbody tr:first div.search_name', '/Specimen 4/')->checkElement('table.saved_searches tbody tr:first span.saved_count', '/1 Item/')->checkElement('table.saved_searches tbody tr:first .favorite_off.hidden')->end()->info('Pin / Unpin')->get('/savesearch/pin?id=1&status=1&source=specimen')->with('response')->begin()->isStatusCode()->matches('/ok/')->end()->get('/savesearch/pin?id=4&status=1&source=specimen')->with('response')->begin()->isStatusCode()->matches('/ok/')->end()->get('specimensearch/search?pinned=true&source=specimen')->with('response')->begin()->isStatusCode()->checkElement('table tbody tr', 2)->end()->get('/savesearch/pin?id=4&status=0&source=specimen')->with('response')->begin()->isStatusCode()->matches('/ok/')->end()->get('specimensearch/search?pinned=true&source=specimen')->with('response')->begin()->isStatusCode()->checkElement('table tbody tr', 1)->end()->info('Save pin to new spec search')->get('savesearch/saveSearch?type=pin&cols=gtu|count&list_nr=create&source=specimen')->with('response')->begin()->isStatusCode()->checkElement('table label', '/Title/')->checkElement('h2', '/Visibility of fields /')->end()->click('#save')->with('response')->begin()->isStatusCode()->matches('/ok/')->end()->get('specimensearch/search?pinned=true&source=specimen')->with('response')->begin()->isStatusCode()->checkElement('.search_results_content', '/No Specimen Matching/')->end()->get('/savesearch/index?specimen=1')->with('response')->begin()->isStatusCode()->checkElement('h1', 'My saved specimens')->checkElement('table.saved_searches')->checkElement('table.saved_searches tbody tr', 2)->checkElement('table.saved_searches tbody tr:first span.saved_count', '/1 Item/')->checkElement('table.saved_searches tbody tr:last span.saved_count', '/1 Item/')->end();
$searches = Doctrine_Query::create()->from('MySavedSearches')->andwhere('is_only_id = true')->orderBy('favorite DESC, id ASC')->execute();
$old_search = $searches[0];
$new_search = $searches[1];
$browser->info('Save pin to existing spec search')->get('/savesearch/pin?id=1&status=1&source=specimen')->with('response')->begin()->isStatusCode()->matches('/ok/')->end()->get('savesearch/saveSearch?type=pin&source=specimen&cols=gtu|count&list_nr=' . $old_search->getId())->with('response')->begin()->isStatusCode()->checkElement('table label', '/Title/')->checkElement('h2', '/Visibility of fields /')->end()->click('#save')->with('response')->begin()->isStatusCode()->matches('/ok/')->end()->get('specimensearch/search?pinned=true&source=specimen')->with('response')->begin()->isStatusCode()->checkElement('.search_results_content', '/No Specimen Matching/')->end()->get('/savesearch/index?specimen=1&source=specimen')->with('response')->begin()->isStatusCode()->checkElement('h1', 'My saved specimens')->checkElement('table.saved_searches')->checkElement('table.saved_searches tbody tr.r_id_' . $old_search->getId())->checkElement('table.saved_searches tbody tr', 2)->checkElement('table.saved_searches tbody tr:first span.saved_count', '/2 Items/')->checkElement('table.saved_searches tbody tr:last span.saved_count', '/1 Item/')->end()->info('Fav / unfav a search')->get('/savesearch/favorite?status=0&id=' . $old_search->getId())->with('response')->begin()->isStatusCode()->matches('/ok/')->end()->get('/savesearch/favorite?status=1&id=' . $new_search->getId())->with('response')->begin()->isStatusCode()->matches('/ok/')->end()->info('Delete a search')->get('/savesearch/index?specimen=1')->click('table.saved_searches tbody tr:first .del_butt')->with('response')->begin()->isStatusCode(302)->end()->get('/savesearch/index?specimen=1')->with('response')->begin()->isStatusCode()->checkElement('h1', 'My saved specimens')->checkElement('table.saved_searches')->checkElement('table.saved_searches tbody tr.r_id_' . $old_search->getId())->checkElement('table.saved_searches tbody tr', 1)->checkElement('table.saved_searches tbody tr:first span.saved_count', '/2 Items/')->end();