Task class for creating and updating test files.
$_fixtures
protected array
$baseTypes
public array
Mapping between packages, and their baseclass + package. This is used to generate App::uses() call to autoload base classes if a developer has forgotten to do so.
$classTypes
public array
$path
public string
$tasks
public array
Add class name to the fixture list. Sets the app. or plugin.plugin_name. prefix.
Process all the models attached to a controller and generate a fixture list.
Process a model recursively and pull out all the model names converting them to fixture names.
Construct an instance of the class to be tested. So that fixtures can be detected
Generate the list of fixtures that will be required to run this test based on loaded models.
Gets the real class name from the cake short form. If the class name is already suffixed with the type, the type will not be duplicated.
Get methods declared in the class given. No parent methods will be returned
Is a mock class required for this type of test? Controllers require a mock class.
Make the filename for the test case. resolve the suffixes for controllers and get the plugin path if needed.
Checks whether the chosen type can find its own fixtures. Currently only model, and controller are supported
_addFixture( string $name )
Add class name to the fixture list. Sets the app. or plugin.plugin_name. prefix.
$name
_interactive( string $type null )
Handles interactive baking
$type
optional null _processController( Controller $subject )
Process all the models attached to a controller and generate a fixture list.
Controller
$subject
_processModel( Model $subject )
Process a model recursively and pull out all the model names converting them to fixture names.
Model
$subject
bake( string $type , string $className )
Completes final steps for generating data to create test case.
$type
$className
buildTestSubject( string $type , string $class )
Construct an instance of the class to be tested. So that fixtures can be detected
$type
$class
execute( )
Execution method always used for tasks
BakeTask::execute()
generateConstructor( string $type , string $fullClassName , string $plugin )
Generate a constructor code snippet for the type and class name
$type
$fullClassName
$plugin
generateFixtureList( CakeObject $subject )
Generate the list of fixtures that will be required to run this test based on loaded models.
CakeObject
$subject
generateUses( string $type , string $realType , string $className )
Generate the uses() calls for a type & class name
$type
$realType
$className
getBaseType( string $type )
Get the base class and package name for a given type.
$type
The type the class having a test generated for is in.
CakeException
getClassName( string $objectType )
Get the user chosen Class name for the chosen type
$objectType
getObjectType( )
Interact with the user and get their chosen type. Can exit the script.
getOptionParser( )
Gets the option parser instance and configures it.
ConsoleOptionParser
getRealClassName( string $type , string $class )
Gets the real class name from the cake short form. If the class name is already suffixed with the type, the type will not be duplicated.
$type
$class
getTestableMethods( string $className )
Get methods declared in the class given. No parent methods will be returned
$className
getUserFixtures( )
Interact with the user to get additional fixtures they want to use.
hasMockClass( string $type )
Is a mock class required for this type of test? Controllers require a mock class.
$type
isLoadableClass( string $package , string $class )
Check if a class with the given package is loaded or can be loaded.
$package
$class
mapType( string $type , string $plugin )
Map the types that TestTask uses to concrete types that App::uses can use.
$type
$plugin
CakeException
testCaseFileName( string $type , string $className )
Make the filename for the test case. resolve the suffixes for controllers and get the plugin path if needed.
$type
$className
typeCanDetectFixtures( string $type )
Checks whether the chosen type can find its own fixtures. Currently only model, and controller are supported
$type
getPath( )
Gets the path for output. Checks the plugin property and returns the correct path.
startup( )
Disable caching and enable debug for baking. This forces the most current database schema to be used.
public array
Mapping between packages, and their baseclass + package. This is used to generate App::uses() call to autoload base classes if a developer has forgotten to do so.
array( 'Model' => array('Model', 'Model'), 'Behavior' => array('ModelBehavior', 'Model'), 'Controller' => array('Controller', 'Controller'), 'Component' => array('Component', 'Controller'), 'Helper' => array('Helper', 'View') )
public array
class types that methods can be generated for
array( 'Model' => 'Model', 'Controller' => 'Controller', 'Component' => 'Controller/Component', 'Behavior' => 'Model/Behavior', 'Helper' => 'View/Helper' )
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/2.9/class-TestTask.html