11<?php
22namespace Kir \MySQL \Databases ;
33
4- use Pseudo \Pdo ;
4+ use Kir \FakePDO \EventHandlers \RegistryEventHandler ;
5+ use Kir \FakePDO \FakePDO ;
56
67class MySQLTest extends \PHPUnit_Framework_TestCase {
78 private $ errorLvl ;
@@ -16,7 +17,7 @@ protected function tearDown() {
1617 }
1718
1819 public function testTransactionTries1 () {
19- $ pdo = new Pdo ();
20+ $ pdo = new FakePDO ();
2021 $ mysql = new MySQL ($ pdo );
2122
2223 $ this ->setExpectedException ('Exception ' , '5 ' );
@@ -29,7 +30,7 @@ public function testTransactionTries1() {
2930 }
3031
3132 public function testTransactionTries2 () {
32- $ pdo = new Pdo ();
33+ $ pdo = new FakePDO ();
3334 $ mysql = new MySQL ($ pdo );
3435
3536 $ result = $ mysql ->transaction (5 , function () {
@@ -45,8 +46,13 @@ public function testTransactionTries2() {
4546 }
4647
4748 public function testGetTableFields () {
48- $ pdo = new Pdo ();
49- $ pdo ->mock ('DESCRIBE test__table ' , [['Field ' => 'a ' ], ['Field ' => 'b ' ], ['Field ' => 'c ' ]]);
49+ $ eventHandler = new RegistryEventHandler ();
50+
51+ $ eventHandler ->add ('PDOStatement::fetchAll ' , function ($ event ) {
52+ return [['Field ' => 'a ' ], ['Field ' => 'b ' ], ['Field ' => 'c ' ]];
53+ });
54+
55+ $ pdo = new FakePDO ($ eventHandler );
5056
5157 $ mysql = new MySQL ($ pdo );
5258 $ mysql ->getAliasRegistry ()->add ('test ' , 'test__ ' );
0 commit comments