Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Commit

Permalink
Rename PHPUnit_Extensions_Database_Operation_Truncate to PHPUnit\DbUn…
Browse files Browse the repository at this point in the history
…it\Operation\Truncate
  • Loading branch information
sebastianbergmann committed Jan 12, 2017
1 parent 4af4903 commit f9a87ff
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/Operation/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use PHPUnit_Extensions_Database_Operation_Insert;
use PHPUnit_Extensions_Database_Operation_Null;
use PHPUnit_Extensions_Database_Operation_Truncate;
use PHPUnit_Extensions_Database_Operation_Update;

/**
Expand Down Expand Up @@ -63,7 +62,7 @@ public static function INSERT()
*/
public static function TRUNCATE($cascadeTruncates = false)
{
$truncate = new PHPUnit_Extensions_Database_Operation_Truncate();
$truncate = new Truncate();
$truncate->setCascade($cascadeTruncates);

return $truncate;
Expand Down
9 changes: 6 additions & 3 deletions src/Operation/Truncate.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace PHPUnit\DbUnit\Operation;

use PDO;
use PDOException;
use PHPUnit\DbUnit\Database\IConnection;
use PHPUnit\DbUnit\DataSet\IDataSet;
use PHPUnit\DbUnit\DataSet\ITable;
use PHPUnit\DbUnit\Operation\Exception;
use PHPUnit\DbUnit\Operation\Operation;

/**
* Executes a truncate against all tables in a dataset.
*/
class PHPUnit_Extensions_Database_Operation_Truncate implements Operation
class Truncate implements Operation
{
protected $useCascade = false;

Expand Down
7 changes: 4 additions & 3 deletions tests/Operation/OperationsMySQLTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use PHPUnit\DbUnit\DataSet\DefaultTable;
use PHPUnit\DbUnit\DataSet\DefaultTableMetadata;
use PHPUnit\DbUnit\DataSet\FlatXmlDataSet;
use PHPUnit\DbUnit\Operation\Truncate;
use PHPUnit\DbUnit\TestCase;

require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'DatabaseTestUtility.php';
Expand Down Expand Up @@ -44,11 +45,11 @@ public function getDataSet()
}

/**
* @covers PHPUnit_Extensions_Database_Operation_Truncate::execute
* @covers Truncate::execute
*/
public function testTruncate()
{
$truncateOperation = new PHPUnit_Extensions_Database_Operation_Truncate();
$truncateOperation = new Truncate();
$truncateOperation->execute($this->getConnection(), $this->getDataSet());

$expectedDataSet = new DefaultDataSet([
Expand Down Expand Up @@ -81,7 +82,7 @@ public function getCompositeDataSet()

public function testTruncateComposite()
{
$truncateOperation = new PHPUnit_Extensions_Database_Operation_Truncate();
$truncateOperation = new Truncate();
$truncateOperation->execute($this->getConnection(), $this->getCompositeDataSet());

$expectedDataSet = new DefaultDataSet([
Expand Down
3 changes: 2 additions & 1 deletion tests/Operation/OperationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use PHPUnit\DbUnit\DataSet\FlatXmlDataSet;
use PHPUnit\DbUnit\Operation\Delete;
use PHPUnit\DbUnit\Operation\DeleteAll;
use PHPUnit\DbUnit\Operation\Truncate;
use PHPUnit\DbUnit\Operation\Replace;
use PHPUnit\DbUnit\TestCase;

Expand Down Expand Up @@ -76,7 +77,7 @@ public function testDeleteAll()

public function testTruncate()
{
$truncateOperation = new PHPUnit_Extensions_Database_Operation_Truncate();
$truncateOperation = new Truncate();

$truncateOperation->execute($this->getConnection(), new FlatXmlDataSet(dirname(__FILE__) . '/../_files/XmlDataSets/DeleteAllOperationTest.xml'));

Expand Down

0 comments on commit f9a87ff

Please sign in to comment.