Changeset 916

Show
Ignore:
Timestamp:
07/22/08 14:54:49 (1 month ago)
Author:
kaste
Message:

Merged back version 0.2.3 that is the version from the plugin @ 658.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/kaste/PHPUnit_TestSuite/README

    r615 r916  
    1919---------- 
    2020 
    21 This TestSuite has its own script (script/test_runner.php) to run your tests. Basically it includes lib/PHPUnit_Akelos which registers the autoloader and includes the config-file (test/fixtures/config/). 
     21This TestSuite has its own script (scripts/test_runner.php) to run your tests. Basically it includes lib/PHPUnit_Akelos which registers the autoloader and includes the config-file (test/fixtures/config/). 
    2222Addionally it creates TestSuites from directories or files on-the-fly. 
    2323 
    24     script/test_runner.php 
     24    scripts/test_runner.php 
    2525     
    26 will print a help message.  
     26will print a help message. 
    2727 
    2828Try 
    2929 
    30     script/test_runner.php -v examples/ 
     30    scripts/test_runner.php -v examples/ 
    3131     
    32 from the root-folder of *this* package. Study these examples, hopefully they're quite self-explanatory. Some of the examples rely on fixtures (an installer f.i.) you can find in tests/fixtures/. 
     32from the root-folder of *this* package. The installer should place a shortcut  
     33 
     34    script/phpunit_testsuite.php ... 
     35     
     36in your app-base dir.  
     37 
     38Study these examples, hopefully they're quite self-explanatory. Some of the examples rely on fixtures (an installer f.i.) you can find in tests/fixtures/. 
    3339 
    3440    
  • branches/kaste/PHPUnit_TestSuite/examples/ModelTest.php

    r620 r916  
    11<?php 
    2 # we add an folder to the search-path of the autoloader, because this plugin has its own fixtures-folder. 
     2# we add a folder to the search-path of the autoloader, because this plugin has its own fixtures-folder. 
    33# usually you don't need this, as long as you use the standard-folders; i.e. test/fixtures/app/* and app/* 
    44PHPUnit_Akelos_autoload::addFolder(AK_PHPUNIT_TESTSUITE_FIXTURES); 
     
    77{ 
    88 
    9     function testUseModel() 
     9    function testBasicUsageToIncludeAModel() 
    1010    { 
    1111        list($Person,$People) = $this->useModel('Person'); 
     
    2323    } 
    2424     
    25     function testGenerateTheModelAndTheTableOnTheFly() 
     25    function testGenerateTheModelAndTheTableOnTheFlyAndGenerateSomeRecords() 
    2626    { 
    2727        # if we hadn't neither an Artist-Model nor an Artist-installer 
     
    3333        $Super = $this->createArtist('name: Supertramp, tag: super-goofy'); 
    3434        $this->assertEquals('Supertramp', $Super->name); 
    35         # since this is a comma-seperated list, escape a <,> with <\,> in your strings  
     35        # since this is a comma-separated list, escape a <,> with <\,> in your strings  
    3636 
    37         # the given data will be merged with the array returned by <defaultArtist()> 
     37        # the given data will be merged with the array returned by the method <defaultArtist()> below 
    3838        $Duran = $this->createArtist('name: Duran Duran'); 
    3939        $this->assertEquals('so-so',$Duran->tag); 
  • branches/kaste/PHPUnit_TestSuite/lib/PHPUnit_Controller_TestCase.php

    r618 r916  
    11<?php 
    22 
    3 abstract class PHPUnit_Controller_TestCase extends PHPUnit_Framework_TestCase  
     3abstract class PHPUnit_Controller_TestCase extends PHPUnit_Model_TestCase  
    44{ 
    55    var $controller_name; 
     
    2222    } 
    2323     
    24     function get($action,$options=array()
     24    function process($request_type,$action,$options
    2525    { 
    2626        $this->action_name = $action; 
    2727        $this->addExpectationsDependendOnActionName($action); 
    2828         
    29         $Request = $this->createRequest('get',$action,$options); 
     29        $Request = $this->createRequest($request_type,$action,$options); 
    3030        $Response = $this->createResponse(); 
    3131        $Controller = $this->createController($this->controller_name); 
     
    3636    } 
    3737     
     38    function get($action,$options=array()) 
     39    { 
     40        $this->process('get',$action,$options); 
     41    } 
     42     
    3843    function post($action,$options=array()) 
    3944    { 
    40         return $this->createRequest('post',$action,$options); 
     45        $this->process('post',$action,$options); 
    4146    } 
    4247     
  • branches/kaste/PHPUnit_TestSuite/lib/PHPUnit_Model_TestCase.php

    r617 r916  
    99     * ->useModel('Person') 
    1010     * will look for an installer-file <person_installer.php> and use it for creating the table.  
    11      * It will include the Person-model or genertae an empty/default model if none is found in the include path. 
    12      * An instance of the model can found at $this->Person. After all it will look for a fixture named 
     11     * It will include the Person-model or generate an empty/default model if none is found in the include path. 
     12     * An instance of the model can be found at $this->Person. After all it will look for a fixture named 
    1313     * <people.yaml> in the path and create the records/rows in the database. A copy of this data can be found 
    1414     * at $this->People as an associative array.  
    15      * Additionally it returns the instance and the fixture-data, so you can do 
     15     * It returns the instance and the fixture-data, so you can do 
    1616     *     list($Person,$People) = $this->useModel('Person');  
    1717     * and use these local variables.  
     
    2020     * will instead of using an installer-file simply use the columns provided. I.e. it will drop and then create 
    2121     * the table <people> with the columns 'id' and 'name'. In fact the table-definition can be the same as in any 
    22      * installer, so you can really quickly prototype your staff.   
     22     * installer, so you can really quickly prototype your stuff.   
    2323     *    
    2424     * 
  • branches/kaste/PHPUnit_TestSuite/tests/lib/ExamplesTestSuite.php

    r619 r916  
    1010         
    1111        $suite = new ExamplesTestSuite(AkInflector::titleize($class_name)); 
    12         $path = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.$test_folder; 
     12        $path = dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.$test_folder; 
    1313         
    1414        $directory = new PHPUnit_Runner_IncludePathTestCollector(array($path)); 
  • branches/kaste/PHPUnit_TestSuite/tests/lib/TestModelTest.php

    r620 r916  
    2121        $this->assertTrue(class_exists('UnusualName',false)); 
    2222         
    23         #we need a table before we can instantiate a ActiveRecord 
     23        #we need a table before we can instantiate an ActiveRecord 
    2424        $this->createTable('UnusualName','id,title'); 
    2525        $this->assertType('ActiveRecord',new UnusualName());