public function testSyncWithNestedPlugin()
{
Plugin::unload();
Plugin::load('Nested/TestPluginTwo');
$this->_clean();
$this->Task->expects($this->atLeast(2))->method('getControllerList')->will($this->returnCallback(function ($plugin, $prefix) {
if ($prefix !== null) {
return [];
}
switch ($plugin) {
case 'Nested/TestPluginTwo':
$return = ['PluginTwoController.php'];
break;
default:
$return = ['CommentsController.php', 'PostsController.php', 'BigLongNamesController.php'];
}
return $return;
}));
$this->Task->startup();
$this->Task->acoUpdate();
$Aco = $this->Task->Acl->Aco;
$originalNode = $Aco->node('controllers/Nested\\TestPluginTwo/PluginTwo')->first();
$cleanTask = $this->getMockBuilder('Acl\\AclExtras')->setMethods(['in', 'out', 'hr', 'createFile', 'error', 'err', 'clear', 'getControllerList'])->getMock();
$cleanTask->expects($this->atLeast(2))->method('getControllerList')->will($this->returnCallback(function ($plugin, $prefix) {
if ($prefix !== null) {
return [];
}
switch ($plugin) {
case 'Nested/TestPluginTwo':
$return = ['PluginTwoController.php'];
break;
default:
$return = ['CommentsController.php', 'PostsController.php', 'BigLongNamesController.php'];
}
return $return;
}));
$cleanTask->startup();
$cleanTask->acoSync();
$updatedNode = $Aco->node('controllers/Nested\\TestPluginTwo/PluginTwo')->first();
$this->assertSame($originalNode->id, $updatedNode->id);
}