Ejemplo n.º 1
0
 public function testInteractiveStrategyShouldAskSuperStrategyAndThenReturnConfirmResult()
 {
     $inputs = m::mock()->shouldIgnoreMissing();
     $inputs->shouldReceive('confirm')->andReturn(false)->once();
     $falseStrategy = m::mock();
     $falseStrategy->shouldReceive('call')->andReturn(false)->once();
     $this->assertFalse(interactiveStrategy(p\PatchFile::_createForTest('n1', 'f1', 'm1', 'e1'), array($falseStrategy, 'call'), $inputs));
 }
Ejemplo n.º 2
0
 public function testSavePatchFileCallsDbInsertIfUpdateAffectedNoRows()
 {
     $patchFile = DBPatcher\PatchFile::_createForTest('n1', 'f1', 'm1', 'e1', DBPatcher\PatchFile::STATUS_INSTALLED);
     $connection = m::mock();
     $connection->shouldReceive('quote')->andReturnUsing(function ($a) {
         return $a;
     });
     $connection->shouldReceive('update')->andReturn(0)->once();
     $connection->shouldReceive('insert')->with('db_patcher', array('status' => DBPatcher\PatchFile::STATUS_INSTALLED, 'md5' => 'm1', 'name' => 'n1'))->once();
     savePatchFile($connection, $patchFile);
 }
Ejemplo n.º 3
0
 public function testPrintPatchPrintsCorrectText()
 {
     $this->assertSame('* n1 [new]', patchText(PatchFile::_createForTest('n1', 'f1', 'm1', 'e1')));
 }
Ejemplo n.º 4
0
 public function testApplyPhpPatchUnsetsProcessTimeouts()
 {
     $process = m::mock()->shouldIgnoreMissing();
     $process->shouldReceive('setTimeout')->with(null)->once();
     $process->shouldReceive('setIdleTimeout')->with(null)->once();
     applyPhpPatch(DBPatcher\PatchFile::_createForTest('n1', 'f1', 'm1', 'php'), $process);
 }