本文整理汇总了PHP中PHPUnit_Framework_MockObject_MockObject::main方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_MockObject_MockObject::main方法的具体用法?PHP PHPUnit_Framework_MockObject_MockObject::main怎么用?PHP PHPUnit_Framework_MockObject_MockObject::main使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Framework_MockObject_MockObject
的用法示例。
在下文中一共展示了PHPUnit_Framework_MockObject_MockObject::main方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMainPlugin
/**
* Test main within a plugin.
*
* @return void
*/
public function testMainPlugin()
{
$this->_loadTestPlugin('TestBake');
$path = Plugin::path('TestBake');
$this->Task->expects($this->at(0))->method('createFile')->with($this->_normalizePath($path . 'src/Shell/Task/ExampleTask.php'), $this->logicalAnd($this->stringContains('namespace TestBake\\Shell\\Task;'), $this->stringContains('class ExampleTask extends Shell')));
$this->Task->main('TestBake.Example');
}
示例2: testMainWithPlugin
/**
* Test the main with plugin.name method.
*
* @return void
*/
public function testMainWithPlugin()
{
Plugin::load('SimpleBakeTest', ['path' => APP . 'Plugin' . DS . 'SimpleBakeTest' . DS]);
$filename = $this->_normalizePath(APP . 'Plugin/SimpleBakeTest/src/Model/Behavior/ExampleBehavior.php');
$this->Task->expects($this->once())->method('createFile')->with($filename, $this->stringContains('class ExampleBehavior extends Behavior'));
$this->Task->Test->expects($this->once())->method('bake')->with('behavior', 'Example');
$this->Task->main('SimpleBakeTest.Example');
}
示例3: testMainPlugin
/**
* Test main within a plugin.
*
* @return void
*/
public function testMainPlugin()
{
$this->_loadTestPlugin('TestBake');
$path = Plugin::path('TestBake');
$this->Task->expects($this->at(0))->method('createFile')->with($this->_normalizePath($path . 'src/Template/Cell/Example/display.ctp'), '');
$this->Task->expects($this->at(1))->method('createFile')->with($this->_normalizePath($path . 'src/View/Cell/ExampleCell.php'), $this->stringContains('class ExampleCell extends Cell'));
$this->Task->main('TestBake.Example');
}
示例4: testMainPlugin
/**
* Test main within a plugin.
*
* @return void
*/
public function testMainPlugin()
{
$this->_loadTestPlugin('TestBake');
$path = Plugin::path('TestBake');
$this->Task->expects($this->at(0))->method('createFile')->with($this->_normalizePath($path . 'src/Template/Layout/Email/html/example.ctp'), '');
$this->Task->expects($this->at(1))->method('createFile')->with($this->_normalizePath($path . 'src/Template/Layout/Email/text/example.ctp'), '');
$this->Task->expects($this->at(2))->method('createFile')->with($this->_normalizePath($path . 'src/Mailer/ExampleMailer.php'), $this->stringContains('class ExampleMailer extends Mailer'));
$this->Task->main('TestBake.Example');
}
示例5: testMainWithNamedModelVariations
/**
* test that execute passes with different inflections of the same name.
*
* @dataProvider nameVariations
* @return void
*/
public function testMainWithNamedModelVariations($name)
{
$this->Task->connection = 'test';
$filename = $this->_normalizePath(APP . 'Model/Table/BakeArticlesTable.php');
$this->Task->expects($this->at(0))->method('createFile')->with($filename, $this->stringContains('class BakeArticlesTable extends Table'));
$this->Task->main($name);
}
示例6: testMain
/**
* Test the main function.
*
* @return void
*/
public function testMain()
{
$this->Shell->loadTasks();
$this->Shell->main();
$output = $this->out->messages();
$expected = ['The following commands can be used to generate skeleton code for your application.', '', '<info>Available bake commands:</info>', '', '- all', '- behavior', '- cell', '- component', '- controller', '- fixture', '- form', '- helper', '- mailer', '- model', '- plugin', '- shell', '- shell_helper', '- task', '- template', '- test', '', 'By using <info>`cake bake [name]`</info> you can invoke a specific bake task.'];
$this->assertSame($expected, $output);
}
示例7: testMainWithPluginDot
/**
* test main with plugin.name
*
* @return void
*/
public function testMainWithPluginDot()
{
$this->Task->connection = 'test';
Plugin::load('ControllerTest', ['path' => APP . 'Plugin/ControllerTest/']);
$path = APP . 'Plugin/ControllerTest/src/Controller/BakeArticlesController.php';
$this->Task->expects($this->at(1))->method('createFile')->with($this->_normalizePath($path), $this->stringContains('BakeArticlesController extends AppController'))->will($this->returnValue(true));
$this->Task->main('ControllerTest.BakeArticles');
}
示例8: testMainUpdateComposer
/**
* Test that baking a plugin for a project that contains a composer.json, the later
* will be updated
*
* @return void
*/
public function testMainUpdateComposer()
{
$this->Task->expects($this->at(0))->method('in')->will($this->returnValue('y'));
$this->io->expects($this->any())->method('askChoice')->will($this->returnValue('y'));
$this->Task->expects($this->any())->method('findComposer')->will($this->returnValue('composer.phar'));
$file = TMP . 'tests' . DS . 'main-composer.json';
file_put_contents($file, '{}');
$savePath = $this->Task->path;
$this->Task->path = ROOT . DS . 'tests' . DS . 'BakedPlugins/';
$this->Task->expects($this->any())->method('_rootComposerFilePath')->will($this->returnValue($file));
$this->Task->expects($this->once())->method('callProcess')->with('php ' . escapeshellarg('composer.phar') . ' dump-autoload');
$this->Task->main('ComposerExample');
$result = file_get_contents($file);
$this->assertSameAsFile(__FUNCTION__ . '.json', $result);
$folder = new Folder($this->Task->path);
$folder->delete();
$this->Task->path = $savePath;
}
示例9: testBake
/**
* Test that bake works
*
* @return void
*/
public function testBake()
{
$this->Task->connection = 'test';
$this->Task->expects($this->at(0))->method('createFile')->with($this->anything(), $this->logicalAnd($this->stringContains('class ArticlesFixture extends TestFixture'), $this->stringContains('public $fields'), $this->stringContains('public $records'), $this->logicalNot($this->stringContains('public $import'))));
$result = $this->Task->main('Articles');
}
示例10: testExecuteWithAll
/**
* test execute with type and class name defined
*
* @return void
*/
public function testExecuteWithAll()
{
$this->Task->expects($this->exactly(2))->method('createFile')->withConsecutive([$this->stringContains('TestCase' . DS . 'Model' . DS . 'Table' . DS . 'ArticlesTableTest.php'), $this->stringContains('class ArticlesTableTest extends TestCase')], [$this->stringContains('TestCase' . DS . 'Model' . DS . 'Table' . DS . 'CategoryThreadsTableTest.php'), $this->stringContains('class CategoryThreadsTableTest extends TestCase')]);
$this->Task->params['all'] = true;
$this->Task->main('Table');
}