<?php

require_once dirname(__FILE__).'/../bootstrap/bootstrap.php';

Doctrine_Query::create()->from('Company')->delete()->execute();
$company = new Company();
$company->name = 'Test Company 1';
$company->created_at = date('Y-m-d', strtotime('-2 months'));
$company->save();

$browser = new sfTestFunctionalHadori(new sfBrowser());
$browser->setTester('export', 'sfTesterCsv');

$browser->info('1. - Test generated module export actions')
  ->runTask('sfThemeGenerateTask', array('theme' => 'my-hadori'), array('application' => 'frontend', 'model' => 'Company', 'module' => 'company'))
    
  ->get('/company')
    ->isModuleAction('company', 'index')
  
  ->with('response')->begin()
    ->matches('/A Custom List Partial For My Theme/')
  ->end()
;
<?php

require_once dirname(__FILE__).'/../bootstrap/bootstrap.php';

Doctrine_Query::create()->from('Company')->delete()->execute();
$company1 = new Company();
$company1->name = 'AAA Company';
$company1->created_at = date('Y-m-d', strtotime('-2 months'));
$company1->save();

$company2 = new Company();
$company2->name = 'ZZZ Company';
$company2->save();

$browser = new sfTestFunctionalHadori(new sfBrowser());

$browser->info('1. - Test generated module filter actions')
  ->runTask('sfThemeGenerateTask', array('theme' => 'hadori'), array('application' => 'frontend', 'model' => 'Company', 'module' => 'company'))

  ->setGeneratorConfigValue('company', 
      array('list' => 
        array('display' => array('name', 'city', 'state', 'zip', 'created_at'))))
    
  ->get('/company')
    ->isModuleAction('company', 'index')
  
  ->with('response')->begin()
    ->matches(sprintf('/%s.*%s/s', $company1['name'], $company2['name']))
  ->end()
  
  ->info('Filter by name - ASC')