本文整理汇总了PHP中CM_Db_Db::truncate方法的典型用法代码示例。如果您正苦于以下问题:PHP CM_Db_Db::truncate方法的具体用法?PHP CM_Db_Db::truncate怎么用?PHP CM_Db_Db::truncate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CM_Db_Db
的用法示例。
在下文中一共展示了CM_Db_Db::truncate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
CM_Db_Db::truncate('cm_modelmock');
CM_Db_Db::truncate('modelThasIsAnAssetMock');
CMTest_TH::clearEnv();
}
示例2: testMonitorSynchronizedCommands
public function testMonitorSynchronizedCommands()
{
$mockBuilder = $this->getMockBuilder('CM_Process');
$mockBuilder->setMethods(['isRunning']);
$mockBuilder->disableOriginalConstructor();
$processMock = $mockBuilder->getMock();
$processMock->expects($this->any())->method('isRunning')->will($this->returnCallback(function ($processId) {
return $processId !== 3;
}));
$mockBuilder = $this->getMockBuilder('CM_Cli_CommandManager');
$mockBuilder->setMethods(['_getProcess', '_getMachineId']);
$commandManagerMock = $mockBuilder->getMock();
$commandManagerMock->expects($this->any())->method('_getProcess')->will($this->returnValue($processMock));
$commandManagerMock->expects($this->any())->method('_getMachineId')->will($this->returnValue('my-machine-1'));
CM_Db_Db::insert('cm_cli_command_manager_process', array('commandName' => 'command-mock1', 'machineId' => 'my-machine-1', 'processId' => 1, 'timeoutStamp' => time() + 60));
CM_Db_Db::insert('cm_cli_command_manager_process', array('commandName' => 'command-mock2', 'machineId' => 'my-machine-1', 'processId' => 2, 'timeoutStamp' => time() - 60));
CM_Db_Db::insert('cm_cli_command_manager_process', array('commandName' => 'command-mock3', 'machineId' => 'my-machine-1', 'processId' => 3, 'timeoutStamp' => time() + 60));
CM_Db_Db::insert('cm_cli_command_manager_process', array('commandName' => 'command-mock4', 'machineId' => 'my-machine-2', 'processId' => 4, 'timeoutStamp' => time() + 60));
CM_Db_Db::insert('cm_cli_command_manager_process', array('commandName' => 'command-mock5', 'machineId' => 'my-machine-2', 'processId' => 5, 'timeoutStamp' => time() - 60));
/** @var CM_Cli_CommandManager $commandManagerMock */
$commandManagerMock->monitorSynchronizedCommands();
$timeoutStampExpected = time() + CM_Cli_CommandManager::TIMEOUT;
$this->assertRow('cm_cli_command_manager_process', array('commandName' => 'command-mock1', 'timeoutStamp' => $timeoutStampExpected));
$this->assertRow('cm_cli_command_manager_process', array('commandName' => 'command-mock2', 'timeoutStamp' => $timeoutStampExpected));
$this->assertNotRow('cm_cli_command_manager_process', array('commandName' => 'command-mock3'));
$this->assertRow('cm_cli_command_manager_process', array('commandName' => 'command-mock4', 'timeoutStamp' => time() + 60));
$this->assertNotRow('cm_cli_command_manager_process', array('commandName' => 'command-mock5'));
CM_Db_Db::truncate('cm_cli_command_manager_process');
}
示例3: createAggregation
public static function createAggregation()
{
CM_Db_Db::truncate('cm_tmp_location');
CM_Db_Db::exec('INSERT INTO `cm_tmp_location` (`level`,`id`,`1Id`,`2Id`,`3Id`,`4Id`,`name`, `abbreviation`, `nameFull`, `lat`,`lon`)
SELECT 1, `1`.`id`, `1`.`id`, NULL, NULL, NULL,
`1`.`name`, `1`.`abbreviation`, CONCAT_WS(" ", `1`.`name`, `1`.`abbreviation`), NULL, NULL
FROM `cm_model_location_country` AS `1`
UNION
SELECT 2, `2`.`id`, `1`.`id`, `2`.`id`, NULL, NULL,
`2`.`name`, `2`.`abbreviation`, CONCAT_WS(" ", `2`.name, `2`.`abbreviation`, `1`.`name`, `1`.`abbreviation`), NULL, NULL
FROM `cm_model_location_state` AS `2`
LEFT JOIN `cm_model_location_country` AS `1` ON(`2`.`countryId`=`1`.`id`)
UNION
SELECT 3, `3`.`id`, `1`.`id`, `2`.`id`, `3`.`id`, NULL,
`3`.`name`, NULL, CONCAT_WS(" ", `3`.`name`, `2`.`name`, `2`.`abbreviation`, `1`.`name`, `1`.`abbreviation`), `3`.`lat`, `3`.`lon`
FROM `cm_model_location_city` AS `3`
LEFT JOIN `cm_model_location_state` AS `2` ON(`3`.`stateId`=`2`.`id`)
LEFT JOIN `cm_model_location_country` AS `1` ON(`3`.`countryId`=`1`.`id`)
UNION
SELECT 4, `4`.`id`, `1`.`id`, `2`.`id`, `3`.`id`, `4`.`id`,
`4`.`name`, NULL, CONCAT_WS(" ", `4`.`name`, `3`.`name`, `2`.`name`, `2`.`abbreviation`, `1`.`name`, `1`.`abbreviation`), `4`.`lat`, `4`.`lon`
FROM `cm_model_location_zip` AS `4`
LEFT JOIN `cm_model_location_city` AS `3` ON(`4`.`cityId`=`3`.`id`)
LEFT JOIN `cm_model_location_state` AS `2` ON(`3`.`stateId`=`2`.`id`)
LEFT JOIN `cm_model_location_country` AS `1` ON(`3`.`countryId`=`1`.`id`)');
CM_Db_Db::truncate('cm_tmp_location_coordinates');
CM_Db_Db::exec('INSERT INTO `cm_tmp_location_coordinates` (`level`,`id`,`coordinates`)
SELECT 3, `id`, POINT(lat, lon)
FROM `cm_model_location_city`
WHERE `lat` IS NOT NULL AND `lon` IS NOT NULL
UNION
SELECT 4, `id`, POINT(lat, lon)
FROM `cm_model_location_zip`
WHERE `lat` IS NOT NULL AND `lon` IS NOT NULL');
}
示例4: tearDown
public function tearDown()
{
CM_Db_Db::truncate('entityMock');
CMTest_TH::clearEnv();
}
示例5: tearDown
protected function tearDown()
{
CM_Db_Db::truncate('mock_modelStorageAdapter');
}
示例6: testMonitorSynchronizedCommands
public function testMonitorSynchronizedCommands()
{
$processMock = $this->getMock('CM_Process', array('getHostId', 'isRunning'), array(), '', false);
$processMock->expects($this->any())->method('getHostId')->will($this->returnValue(1));
$processMock->expects($this->any())->method('isRunning')->will($this->returnCallback(function ($processId) {
return $processId !== 3;
}));
$commandManagerMock = $this->getMock('CM_Cli_CommandManager', array('_getProcess'));
$commandManagerMock->expects($this->any())->method('_getProcess')->will($this->returnValue($processMock));
CM_Db_Db::insert('cm_cli_command_manager_process', array('commandName' => 'command-mock1', 'hostId' => 1, 'processId' => 1, 'timeoutStamp' => time() + 60));
CM_Db_Db::insert('cm_cli_command_manager_process', array('commandName' => 'command-mock2', 'hostId' => 1, 'processId' => 2, 'timeoutStamp' => time() - 60));
CM_Db_Db::insert('cm_cli_command_manager_process', array('commandName' => 'command-mock3', 'hostId' => 1, 'processId' => 3, 'timeoutStamp' => time() + 60));
CM_Db_Db::insert('cm_cli_command_manager_process', array('commandName' => 'command-mock4', 'hostId' => 2, 'processId' => 4, 'timeoutStamp' => time() + 60));
CM_Db_Db::insert('cm_cli_command_manager_process', array('commandName' => 'command-mock5', 'hostId' => 2, 'processId' => 5, 'timeoutStamp' => time() - 60));
/** @var CM_Cli_CommandManager $commandManagerMock */
$commandManagerMock->monitorSynchronizedCommands();
$timeoutStampExpected = time() + CM_Cli_CommandManager::TIMEOUT;
$this->assertRow('cm_cli_command_manager_process', array('commandName' => 'command-mock1', 'timeoutStamp' => $timeoutStampExpected));
$this->assertRow('cm_cli_command_manager_process', array('commandName' => 'command-mock2', 'timeoutStamp' => $timeoutStampExpected));
$this->assertNotRow('cm_cli_command_manager_process', array('commandName' => 'command-mock3'));
$this->assertRow('cm_cli_command_manager_process', array('commandName' => 'command-mock4', 'timeoutStamp' => time() + 60));
$this->assertNotRow('cm_cli_command_manager_process', array('commandName' => 'command-mock5'));
CM_Db_Db::truncate('cm_cli_command_manager_process');
}
示例7: tearDown
public function tearDown()
{
CM_Db_Db::truncate('cm_user_preferenceDefault');
}