Changeset 2703

Show
Ignore:
Timestamp:
08/25/08 09:46:05 (5 months ago)
Author:
felix
Message:

added first unit test for the sample app, POC code only

  • Test name is hardcoded in the AgaviTesting?.php
  • requires a hacked PHPUnit version of an deleted branch :(
  • requires putting the base class in the main autoload not in the module autoload as it should be

refs #380

Location:
branches/felix-testing-implementation
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • branches/felix-testing-implementation/samples/app/config/autoload.xml

    r2371 r2703  
    1010       
    1111      <autoload name="AgaviSampleAppUser">%core.lib_dir%/user/AgaviSampleAppUser.class.php</autoload> 
     12       
     13      <!-- added here so that the tests can find the proper base model, currently they don't load the module specific autoload --> 
     14      <autoload name="AgaviSampleAppDefaultBaseModel">%core.module_dir%/Default/lib/model/AgaviSampleAppDefaultBaseModel.class.php</autoload> 
    1215    </autoloads> 
    1316  </configuration> 
  • branches/felix-testing-implementation/samples/test/tests.php

    r2238 r2703  
    55require('config.php'); 
    66 
    7 AgaviTesting::bootstrap('testing-david'); 
    8  
     7AgaviTesting::bootstrap('testing-felix'); 
    98AgaviTesting::dispatch(); 
    109 
  • branches/felix-testing-implementation/src/testing/AgaviTesting.class.php

    r2238 r2703  
    7676    AgaviConfig::set('testing.environment', $environment, true, true); 
    7777     
     78    ini_set('include_path', get_include_path().PATH_SEPARATOR.dirname(dirname(__FILE__))); 
     79 
    7880    $_ENV['AGAVI'] = AgaviConfig::toArray(); 
    7981  } 
    80    
     82 
    8183  public function dispatch() 
    8284  { 
    83     $suite = new PHPUnit_Framework_TestSuite(); 
    84      
     85    $suite = new AgaviUnitTestSuite('Foo'); 
     86    //require_once 'tests/unit/PriceFinderModelTest.php'; 
     87    //$test = new PriceFinderModelTest(); 
     88    //$test->setName('PriceFinder Model'); 
     89    //$suite->addTest($test); 
     90    $suite->addTestFile('tests/unit/PriceFinderModelTest.php'); 
     91 
     92 
    8593    // TODO: read test suites from xml or so 
    86      
     94 
    8795    $runner = PHPUnit_TextUI_TestRunner::run($suite); 
    8896  }