本文整理汇总了PHP中ClassRegistry::mapKeys方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassRegistry::mapKeys方法的具体用法?PHP ClassRegistry::mapKeys怎么用?PHP ClassRegistry::mapKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassRegistry
的用法示例。
在下文中一共展示了ClassRegistry::mapKeys方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExecuteIntoInteractive
/**
* test the interactive side of bake.
*
* @return void
*/
public function testExecuteIntoInteractive()
{
$tables = $this->Task->listAll('test');
$article = array_search('bake_articles', $tables) + 1;
$this->Task->connection = 'test';
$this->Task->path = '/my/path/';
$this->Task->interactive = true;
$this->Task->expects($this->any())->method('in')->will($this->onConsecutiveCalls($article, 'n', 'y', 'y', 'y', 'y', 'n', 'y'));
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(true));
$this->Task->Test->expects($this->once())->method('bake');
$this->Task->Fixture->expects($this->once())->method('bake');
$filename = '/my/path/BakeArticle.php';
$this->Task->expects($this->once())->method('createFile')->with($filename, $this->stringContains('class BakeArticle'));
$this->Task->execute();
$this->assertEquals(count(ClassRegistry::keys()), 0);
$this->assertEquals(count(ClassRegistry::mapKeys()), 0);
}
示例2: testExecuteIntoInteractive
/**
* test the interactive side of bake.
*
* @return void
*/
public function testExecuteIntoInteractive()
{
$count = count($this->Task->listAll('test'));
if ($count != count($this->fixtures)) {
$this->markTestSkipped('Additional tables detected.');
}
$this->Task->connection = 'test';
$this->Task->path = '/my/path/';
$this->Task->interactive = true;
$this->Task->expects($this->any())->method('in')->will($this->onConsecutiveCalls('1', 'n', 'y', 'y', 'y', 'y', 'n', 'y'));
$this->Task->expects($this->once())->method('_checkUnitTest')->will($this->returnValue(true));
$this->Task->Test->expects($this->once())->method('bake');
$this->Task->Fixture->expects($this->once())->method('bake');
$filename = '/my/path/BakeArticle.php';
$this->Task->expects($this->once())->method('createFile')->with($filename, $this->stringContains('class BakeArticle'));
$this->Task->execute();
$this->assertEqual(count(ClassRegistry::keys()), 0);
$this->assertEqual(count(ClassRegistry::mapKeys()), 0);
}
示例3: testExecuteIntoInteractive
/**
* test the interactive side of bake.
*
* @return void
* @access public
*/
function testExecuteIntoInteractive()
{
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$this->Task->interactive = true;
$this->Task->setReturnValueAt(0, 'in', '1');
//choose article
$this->Task->setReturnValueAt(1, 'in', 'n');
//no validation
$this->Task->setReturnValueAt(2, 'in', 'y');
//yes to associations
$this->Task->setReturnValueAt(3, 'in', 'y');
//yes to comment relation
$this->Task->setReturnValueAt(4, 'in', 'y');
//yes to user relation
$this->Task->setReturnValueAt(5, 'in', 'y');
//yes to tag relation
$this->Task->setReturnValueAt(6, 'in', 'n');
//no to additional assocs
$this->Task->setReturnValueAt(7, 'in', 'y');
//yes to looksGood?
$this->Task->setReturnValue('_checkUnitTest', true);
$this->Task->Test->expectOnce('bake');
$this->Task->Fixture->expectOnce('bake');
$filename = '/my/path/article.php';
$this->Task->expectOnce('createFile');
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class Article/')));
$this->Task->execute();
$this->assertEqual(count(ClassRegistry::keys()), 0);
$this->assertEqual(count(ClassRegistry::mapKeys()), 0);
}
示例4: testBakeModel
/**
* test that execute passes runs bake depending with named model.
*
* @return void
* @access public
*/
function testBakeModel()
{
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$filename = '/my/path/article.php';
$this->Task->setReturnValue('_checkUnitTest', 1);
$this->Task->expectAt(0, 'createFile', array($filename, new PatternExpectation('/class Article extends AppModel/')));
$model =& new Model(array('name' => 'Article', 'table' => 'articles', 'ds' => 'test_suite'));
$this->Task->bake($model);
$this->assertEqual(count(ClassRegistry::keys()), 0);
$this->assertEqual(count(ClassRegistry::mapKeys()), 0);
}