Skip to content

Commit

Permalink
Fixing MigrationVersionTest::testSetGetVersion().
Browse files Browse the repository at this point in the history
  • Loading branch information
renan committed Nov 18, 2011
1 parent 06efc88 commit df4c6ee
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Test/Case/Lib/MigrationVersionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,22 +154,35 @@ public function testGetMigration() {
* @return void
*/
public function testSetGetVersion() {
$this->Version = $this->getMock('MigrationVersion', array('getMapping'), array(array('connection' => 'test')));

// Checking current
$this->Version->expects($this->at(0))->method('getMapping')->will($this->returnValue($this->__mapping()));
$result = $this->Version->getVersion('inexistent_plugin');
$expected = 0;
$this->assertEqual($result, $expected);

// Setting as 1
$this->Version->expects($this->at(0))->method('getMapping')->will($this->returnValue($this->__mapping()));
$this->Version->expects($this->at(1))->method('getMapping')->will($this->returnValue($this->__mapping(1, 1)));
$setResult = $this->Version->setVersion(1, 'inexistent_plugin');
$this->assertTrue(!empty($setResult));
$result = $this->Version->getVersion('inexistent_plugin');
$expected = 1;
$this->assertEqual($result, $expected);

// Setting as 2
$this->Version->expects($this->at(0))->method('getMapping')->will($this->returnValue($this->__mapping(1, 1)));
$this->Version->expects($this->at(1))->method('getMapping')->will($this->returnValue($this->__mapping(1, 2)));
$setResult = $this->Version->setVersion(2, 'inexistent_plugin');
$this->assertTrue(!empty($setResult));
$result = $this->Version->getVersion('inexistent_plugin');
$expected = 2;
$this->assertEqual($result, $expected);

// Setting as 1
$this->Version->expects($this->at(0))->method('getMapping')->will($this->returnValue($this->__mapping(1, 2)));
$this->Version->expects($this->at(1))->method('getMapping')->will($this->returnValue($this->__mapping(1, 1)));
$setResult = $this->Version->setVersion(2, 'inexistent_plugin', false);
$this->assertTrue(!empty($setResult));
$result = $this->Version->getVersion('inexistent_plugin');
Expand Down

0 comments on commit df4c6ee

Please sign in to comment.