for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Maketok\DataMigration\Action\Type;
use Maketok\DataMigration\Storage\Db\ResourceInterface;
use Maketok\DataMigration\Unit\Type\Unit;
class ReverseMoveTest extends \PHPUnit_Framework_TestCase
{
use ServiceGetterTrait;
public function testGetCode()
$action = new ReverseMove(
$this->getUnitBag(),
$this->getConfig(),
$this->getResource()
);
$this->assertEquals('reverse_move', $action->getCode());
}
/**
* @param string $code
* @return Unit
*/
public function getUnit($code)
$unit = new Unit($code);
$unit->setReverseMoveConditions([
"id != 5"
]);
$unit->setReverseMoveOrder([
'id'
$unit->setReverseMoveDirection('desc');
return $unit;
* @param bool $expects
* @return ResourceInterface
protected function getResource($expects = false)
$resource = $this->getMockBuilder('\Maketok\DataMigration\Storage\Db\ResourceInterface')
->getMock();
if ($expects) {
$resource->expects($this->atLeastOnce())
->method('move');
return $resource;
public function testProcess()
$unit = $this->getUnit('tmp');
$this->getUnitBag([$unit]),
$this->getResource(true)
$action->process($this->getResultMock());
$this->assertNotEmpty($unit->getTmpTable());