public function test() { $this->adapter->expects($this->atLeastOnce())->method('hasTable')->will($this->returnValueMap([['users', true], ['users_new', true]])); $this->adapter->expects($this->atLeastOnce())->method('quoteTableName')->will($this->returnCallback(function ($name) { return "`{$name}`"; })); $this->adapter->expects($this->once())->method('query')->with('RENAME TABLE `users` TO `users_archive`, `users_new` TO `users`'); $this->origin->expects($this->atLeastOnce())->method('getName')->will($this->returnValue('users')); $this->destination->expects($this->atLeastOnce())->method('getName')->will($this->returnValue('users_new')); $this->switcher->run(); }
public function testItRenamesDestinationToOrigin() { $this->assertTrue($this->adapter->hasTable($this->destination->getName())); $this->switcher->run(); $this->assertFalse($this->adapter->hasTable($this->destination->getName())); }