Bake\Shell\Task\TestTask::generateProperties PHP Метод

generateProperties() публичный Метод

The generated property info consists of a set of arrays that hold the following keys: - description (the property description) - type (the property docblock type) - name (the property name) - value (optional - the properties initial value)
public generateProperties ( string $type, string $subject, string $fullClassName ) : array
$type string The Type of object you are generating tests for eg. controller
$subject string The name of the test subject.
$fullClassName string The Classname of the class the test is being generated for.
Результат array An array containing property info
    public function generateProperties($type, $subject, $fullClassName)
    {
        $type = strtolower($type);
        $properties = [];
        switch (strtolower($type)) {
            case 'cell':
                $properties[] = ['description' => 'Request mock', 'type' => '\\Cake\\Network\\Request|\\PHPUnit_Framework_MockObject_MockObject', 'name' => 'request'];
                $properties[] = ['description' => 'Response mock', 'type' => '\\Cake\\Network\\Response|\\PHPUnit_Framework_MockObject_MockObject', 'name' => 'response'];
                break;
            case 'shell':
            case 'task':
                $properties[] = ['description' => 'ConsoleIo mock', 'type' => '\\Cake\\Console\\ConsoleIo|\\PHPUnit_Framework_MockObject_MockObject', 'name' => 'io'];
                break;
            case 'shell_helper':
                $properties[] = ['description' => 'ConsoleOutput stub', 'type' => '\\Cake\\TestSuite\\Stub\\ConsoleOutput', 'name' => 'stub'];
                $properties[] = ['description' => 'ConsoleIo mock', 'type' => '\\Cake\\Console\\ConsoleIo', 'name' => 'io'];
                break;
        }
        if ($type !== 'controller') {
            $properties[] = ['description' => 'Test subject', 'type' => '\\' . $fullClassName, 'name' => $subject];
        }
        return $properties;
    }