mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-08-05 23:53:38 +02:00
Backup of current cakephp version
This commit is contained in:
parent
b8f82da6f8
commit
5a580df460
925 changed files with 238041 additions and 1 deletions
118
lib/Cake/Test/Case/Console/Command/CommandListShellTest.php
Normal file
118
lib/Cake/Test/Case/Console/Command/CommandListShellTest.php
Normal file
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
/**
|
||||
* CommandListShellTest file
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2012, Cake Software Foundation, Inc.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
|
||||
* @link http://cakephp.org CakePHP Project
|
||||
* @package Cake.Test.Case.Console.Command
|
||||
* @since CakePHP v 2.0
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
App::uses('CommandListShell', 'Console/Command');
|
||||
App::uses('ConsoleOutput', 'Console');
|
||||
App::uses('ConsoleInput', 'Console');
|
||||
App::uses('Shell', 'Console');
|
||||
|
||||
|
||||
class TestStringOutput extends ConsoleOutput {
|
||||
|
||||
public $output = '';
|
||||
|
||||
protected function _write($message) {
|
||||
$this->output .= $message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CommandListShellTest extends CakeTestCase {
|
||||
|
||||
/**
|
||||
* setUp method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
App::build(array(
|
||||
'Plugin' => array(
|
||||
CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS
|
||||
),
|
||||
'Console/Command' => array(
|
||||
CAKE . 'Test' . DS . 'test_app' . DS . 'Console' . DS . 'Command' . DS
|
||||
)
|
||||
), App::RESET);
|
||||
CakePlugin::load(array('TestPlugin', 'TestPluginTwo'));
|
||||
|
||||
$out = new TestStringOutput();
|
||||
$in = $this->getMock('ConsoleInput', array(), array(), '', false);
|
||||
|
||||
$this->Shell = $this->getMock(
|
||||
'CommandListShell',
|
||||
array('in', '_stop', 'clear'),
|
||||
array($out, $out, $in)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* tearDown
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
unset($this->Shell);
|
||||
CakePlugin::unload();
|
||||
}
|
||||
|
||||
/**
|
||||
* test that main finds core shells.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testMain() {
|
||||
$this->Shell->main();
|
||||
$output = $this->Shell->stdout->output;
|
||||
|
||||
$expected = "/\[.*TestPlugin.*\] example/";
|
||||
$this->assertRegExp($expected, $output);
|
||||
|
||||
$expected = "/\[.*TestPluginTwo.*\] example, welcome/";
|
||||
$this->assertRegExp($expected, $output);
|
||||
|
||||
$expected = "/\[.*CORE.*\] acl, api, bake, command_list, console, i18n, schema, test, testsuite, upgrade/";
|
||||
$this->assertRegExp($expected, $output);
|
||||
|
||||
$expected = "/\[.*app.*\] sample/";
|
||||
$this->assertRegExp($expected, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* test xml output.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testMainXml() {
|
||||
$this->Shell->params['xml'] = true;
|
||||
$this->Shell->main();
|
||||
|
||||
$output = $this->Shell->stdout->output;
|
||||
|
||||
$find = '<shell name="sample" call_as="sample" provider="app" help="sample -h"/>';
|
||||
$this->assertContains($find, $output);
|
||||
|
||||
$find = '<shell name="bake" call_as="bake" provider="CORE" help="bake -h"/>';
|
||||
$this->assertContains($find, $output);
|
||||
|
||||
$find = '<shell name="welcome" call_as="TestPluginTwo.welcome" provider="TestPluginTwo" help="TestPluginTwo.welcome -h"/>';
|
||||
$this->assertContains($find, $output);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue