<?php include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new dnTestFunctional(new sfBrowser()); $neededStuff = csFactory::create('StuffResource', array('transaction_type' => 'need', 'title' => csFactory::generate('Stuff Resource '), 'owner_id' => csFactory::selectRandomId('sfGuardUser'))); $neededStuff->save(); $browser->get('/')->click('I Have')->isModuleAction('resource', 'have')->click('Stuff')->isModuleAction('stuff', 'have')->info('first we will look for something that is a have-resource, a pump, and expect no results')->call('/stuff/list', 'post', $parameters = array('q' => 'pump', 'type' => 'need'))->isModuleAction('resource', 'stuffList')->info('you have a pump? yeah so do we.')->with('response')->begin()->matches('!/pump/i')->end()->call('/stuff/list', 'post', $parameters = array('q' => 'picnic', 'type' => 'need'))->isModuleAction('resource', 'stuffList')->with('response')->begin()->matches('/picnic/i')->end()->call('/stuff/list', 'post', $parameters = array('q' => $neededStuff['title'], 'type' => 'need'))->isModuleAction('resource', 'stuffList')->with('response')->begin()->matches(sprintf('/%s/i', $neededStuff['title']))->end()->get(sprintf('/have/stuff/%s', $neededStuff['id']))->isModuleAction('stuff', 'show')->with('response')->begin()->matches(sprintf('/%s/', $neededStuff['title']))->end();
<?php include dirname(__FILE__) . '/../bootstrap/Doctrine.php'; // $app = 'frontend'; // include(dirname(__FILE__) . '/../bootstrap/functional.php'); $t = new lime_test(6, new lime_output_color()); $user = csFactory::create('sfGuardUser', array('username' => csFactory::generate())); $user['Profile'] = csFactory::create('sfGuardUserProfile'); $user->save(); $t->is($user['Profile']->getAddressArray(), array(), 'No Address Info'); $t->is($user['Profile']->getAddress(), '', 'No Address Info'); $user['Profile']['city'] = 'Nashville'; $t->is($user['Profile']->getAddress(), 'Nashville', 'Correct Address Info'); $user['Profile']['state'] = 'TN'; $t->is($user['Profile']->getAddress(), 'Nashville, TN', 'Correct Address Info'); $user['Profile']['zip'] = '37211'; $t->is($user['Profile']->getAddress(), 'Nashville, TN, 37211', 'Correct Address Info'); $user['Profile']['address_1'] = '5157 Whitaker Dr.'; $t->is($user['Profile']->getAddress("\n"), "5157 Whitaker Dr.\nNashville, TN, 37211", 'Correct Address Info');
<?php include dirname(__FILE__) . '/../bootstrap/Doctrine.php'; $app = 'frontend'; include dirname(__FILE__) . '/../bootstrap/functional.php'; $t = new lime_test(12, new lime_output_color()); $stuff = new StuffResource(); $stuff['title'] = 'Stuff Resource ' . csFactory::generate(); $stuff['owner_id'] = csFactory::selectRandomId('sfGuardUser'); $stuff->save(); $resources = Doctrine::getTable('StuffResource')->getListQuery(csFactory::last()); $t->is($resources->count(), 1, 'One stuff item returned'); $time = new TimeResource(); $time['title'] = 'Time Resource ' . csFactory::generate(); $time['owner_id'] = csFactory::selectRandomId('sfGuardUser'); $time['resource_date'] = date('Y-m-d', strtotime('-1 weeks')); $time['start_time'] = '00:00:00'; $time['end_time'] = '12:00:00'; $time->save(); $resources = Doctrine::getTable('TimeResource')->getListQuery(date('Y-m-d 02:00:00', strtotime('-1 weeks, -1 days')))->andWhere('title = ?', $time['title'])->execute(); $t->is($resources->count(), 0, 'No time items returned - start date out of range, end date not specified'); $resources = Doctrine::getTable('TimeResource')->getListQuery(date('Y-m-d 02:00:00', strtotime('-1 weeks')))->andWhere('title = ?', $time['title'])->execute(); $t->is($resources->count(), 1, 'One time item returned - start date in range'); $t->is($resources->getFirst()->getTitle(), $time['title'], 'correct resource title'); $resources = Doctrine::getTable('TimeResource')->getListQuery(date('Y-m-d', strtotime('-1 weeks')), date('Y-m-d', strtotime('+1 months')))->andWhere('title = ?', $time['title'])->execute(); $t->is($resources->count(), 1, 'One time item returned - start date in range, end date after range'); $t->is($resources->getFirst()->getTitle(), $time['title'], 'correct resource title'); $resources = Doctrine::getTable('TimeResource')->getListQuery(date('Y-m-d', strtotime('-1 months')), date('Y-m-d', strtotime('+1 months')))->andWhere('title = ?', $time['title'])->execute(); $t->is($resources->count(), 1, 'One time item returned - start date before range, end date after range'); $t->is($resources->getFirst()->getTitle(), $time['title'], 'correct resource title'); $resources = Doctrine::getTable('TimeResource')->getListQuery(date('Y-m-d', strtotime('-1 months')), date('Y-m-d', strtotime('+1 days')))->andWhere('title = ?', $time['title'])->execute();