| @@ 3802-3828 (lines=27) @@ | ||
| 3799 | * |
|
| 3800 | * @return void |
|
| 3801 | */ |
|
| 3802 | public function testTruncateStatements() { |
|
| 3803 | $this->loadFixtures('Article', 'User'); |
|
| 3804 | $db = ConnectionManager::getDatasource('test'); |
|
| 3805 | $schema = $db->config['database']; |
|
| 3806 | $Article = new Article(); |
|
| 3807 | ||
| 3808 | $this->Dbo = $this->getMock('Mysql', array('execute'), array($db->config)); |
|
| 3809 | ||
| 3810 | $this->Dbo->expects($this->at(0))->method('execute') |
|
| 3811 | ->with("TRUNCATE TABLE `$schema`.`articles`"); |
|
| 3812 | $this->Dbo->truncate($Article); |
|
| 3813 | ||
| 3814 | $this->Dbo->expects($this->at(0))->method('execute') |
|
| 3815 | ->with("TRUNCATE TABLE `$schema`.`articles`"); |
|
| 3816 | $this->Dbo->truncate('articles'); |
|
| 3817 | ||
| 3818 | // #2355: prevent duplicate prefix |
|
| 3819 | $this->Dbo->config['prefix'] = 'tbl_'; |
|
| 3820 | $Article->tablePrefix = 'tbl_'; |
|
| 3821 | $this->Dbo->expects($this->at(0))->method('execute') |
|
| 3822 | ->with("TRUNCATE TABLE `$schema`.`tbl_articles`"); |
|
| 3823 | $this->Dbo->truncate($Article); |
|
| 3824 | ||
| 3825 | $this->Dbo->expects($this->at(0))->method('execute') |
|
| 3826 | ->with("TRUNCATE TABLE `$schema`.`tbl_articles`"); |
|
| 3827 | $this->Dbo->truncate('articles'); |
|
| 3828 | } |
|
| 3829 | ||
| 3830 | /** |
|
| 3831 | * Test nested transaction |
|
| @@ 972-998 (lines=27) @@ | ||
| 969 | * |
|
| 970 | * @return void |
|
| 971 | */ |
|
| 972 | public function testTruncateStatements() { |
|
| 973 | $this->loadFixtures('Article', 'User'); |
|
| 974 | $db = ConnectionManager::getDatasource('test'); |
|
| 975 | $schema = $db->config['schema']; |
|
| 976 | $Article = new Article(); |
|
| 977 | ||
| 978 | $this->Dbo = $this->getMock('Postgres', array('execute'), array($db->config)); |
|
| 979 | ||
| 980 | $this->Dbo->expects($this->at(0))->method('execute') |
|
| 981 | ->with("DELETE FROM \"$schema\".\"articles\""); |
|
| 982 | $this->Dbo->truncate($Article); |
|
| 983 | ||
| 984 | $this->Dbo->expects($this->at(0))->method('execute') |
|
| 985 | ->with("DELETE FROM \"$schema\".\"articles\""); |
|
| 986 | $this->Dbo->truncate('articles'); |
|
| 987 | ||
| 988 | // #2355: prevent duplicate prefix |
|
| 989 | $this->Dbo->config['prefix'] = 'tbl_'; |
|
| 990 | $Article->tablePrefix = 'tbl_'; |
|
| 991 | $this->Dbo->expects($this->at(0))->method('execute') |
|
| 992 | ->with("DELETE FROM \"$schema\".\"tbl_articles\""); |
|
| 993 | $this->Dbo->truncate($Article); |
|
| 994 | ||
| 995 | $this->Dbo->expects($this->at(0))->method('execute') |
|
| 996 | ->with("DELETE FROM \"$schema\".\"tbl_articles\""); |
|
| 997 | $this->Dbo->truncate('articles'); |
|
| 998 | } |
|
| 999 | ||
| 1000 | /** |
|
| 1001 | * Test nested transaction |
|