Skip to content

Commit

Permalink
added more tests for PdoStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
havvg committed Nov 18, 2011
1 parent 4dd3790 commit b6285f0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Sismo/Contrib/PdoStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,9 @@ public function close()

return $this;
}

public function __destruct()
{
$this->close();
}
}
19 changes: 19 additions & 0 deletions tests/Sismo/Tests/PdoStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ public function setUp()
$this->db->exec($app['db.schema']);
}

public function testStaticCreate()
{
$this->assertInstanceOf('\Sismo\Contrib\PdoStorage', PdoStorage::create('sqlite::memory:'));
}

public function testInitExistingCommit()
{
$project = $this->getProject();

$storage = $this->getStorage();
$commit = $storage->initCommit($project, '7d78d5', 'fabien', new \DateTime(), 'foo');
$this->assertInstanceOf('\Sismo\Commit', $commit);

$commit2 = $storage->initCommit($project, '7d78d5', 'fabien', new \DateTime(), 'foo-amended');
$this->assertInstanceOf('\Sismo\Commit', $commit2);

$this->assertEquals('foo-amended', $storage->getCommit($project, '7d78d5')->getMessage());
}

public function tearDown()
{
unset($this->db);
Expand Down

0 comments on commit b6285f0

Please sign in to comment.