11<?php
22
33use G4 \DataMapper \Builder ;
4+ use G4 \DataMapper \Engine \MySQL \MySQLMapper ;
45use G4 \DataMapper \Engine \MySQL \MySQLTableName ;
56
6- class BuilderTest extends PHPUnit_Framework_TestCase
7+ class BuilderTest extends \ PHPUnit \ Framework \TestCase
78{
89
910 /**
@@ -16,8 +17,7 @@ class BuilderTest extends PHPUnit_Framework_TestCase
1617 */
1718 private $ params ;
1819
19-
20- protected function setUp ()
20+ protected function setUp (): void
2121 {
2222 $ this ->params = [
2323 'host ' => 'localhost ' ,
@@ -29,7 +29,7 @@ protected function setUp()
2929 $ this ->builder = Builder::create ();
3030 }
3131
32- protected function tearDown ()
32+ protected function tearDown (): void
3333 {
3434 $ this ->params = null ;
3535 $ this ->builder = null ;
@@ -54,7 +54,7 @@ public function testBuildMapper()
5454 $ this ->builder
5555 ->collectionName (new MySQLTableName ('profiles ' ))
5656 ->adapter ($ this ->getMockForMySQLAdapter ());
57- $ this ->builder ->buildMapper ();
57+ $ this ->assertInstanceOf (MySQLMapper::class, $ this -> builder ->buildMapper () );
5858 }
5959
6060 public function testBuildBulk ()
@@ -76,7 +76,7 @@ public function testBuildWithNoAdapter()
7676
7777 public function testBuildWithNoType ()
7878 {
79- $ this ->builder ->adapter ($ this ->getMock ('\G4\DataMapper\Common\AdapterInterface ' ));
79+ $ this ->builder ->adapter ($ this ->createMock ('\G4\DataMapper\Common\AdapterInterface ' ));
8080 $ this ->expectException ('\Exception ' );
8181 $ this ->expectExceptionCode (601 );
8282 $ this ->expectExceptionMessage ('DataSet cannot be emty ' );
@@ -86,7 +86,7 @@ public function testBuildWithNoType()
8686 public function testBuildForUnknownEngine ()
8787 {
8888 $ this ->builder
89- ->adapter ($ this ->getMock ('\G4\DataMapper\Common\AdapterInterface ' ))
89+ ->adapter ($ this ->createMock ('\G4\DataMapper\Common\AdapterInterface ' ))
9090 ->collectionName (new MySQLTableName ('profiles ' ));
9191 $ this ->expectException ('\Exception ' );
9292 $ this ->expectExceptionCode (601 );
@@ -104,12 +104,10 @@ public function testBuildTransaction()
104104
105105 private function getMockForMySQLAdapter ()
106106 {
107- return $ this ->getMock (
108- '\G4\DataMapper\Engine\MySQL\MySQLAdapter ' ,
109- null ,
110- [
111- $ this ->getMock ('\G4\DataMapper\Engine\MySQL\MySQLClientFactory ' , null , [$ this ->params ]),
112- ]
113- );
107+ return $ this ->getMockBuilder ('\G4\DataMapper\Engine\MySQL\MySQLAdapter ' )
108+ ->setConstructorArgs ([
109+ $ this ->createMock ('\G4\DataMapper\Engine\MySQL\MySQLClientFactory ' ),
110+ ])
111+ ->getMock ();
114112 }
115113}
0 commit comments