-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TestConnection: Add return type to setFetchMode
Slipped through in #88 as it's not used at all here. Now a test exists which does.
- Loading branch information
Showing
2 changed files
with
62 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace ipl\Tests\Sql; | ||
|
||
use ipl\Sql\Test\TestConnection; | ||
|
||
class TestConnectionTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testPrepexec() | ||
{ | ||
$connection = new TestConnection(); | ||
$stmt = $connection->prepexec('SELECT * FROM foo'); | ||
$this->assertEmpty(iterator_to_array($stmt)); | ||
$this->assertTrue($stmt->setFetchMode(\PDO::FETCH_ASSOC)); | ||
} | ||
|
||
public function testBeginTransaction() | ||
{ | ||
$connection = new TestConnection(); | ||
$this->expectException(\LogicException::class); | ||
$connection->beginTransaction(); | ||
} | ||
|
||
public function testCommitTransaction() | ||
{ | ||
$connection = new TestConnection(); | ||
$this->expectException(\LogicException::class); | ||
$connection->commitTransaction(); | ||
} | ||
|
||
public function testRollbackTransaction() | ||
{ | ||
$connection = new TestConnection(); | ||
$this->expectException(\LogicException::class); | ||
$connection->rollbackTransaction(); | ||
} | ||
} |