diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1dfd578..3a24364 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,21 +1,11 @@ - - - ./test/Crate/Test - - - - ./src - - + + + + ./src + + + + ./test/Crate/Test + diff --git a/test/Crate/Test/DBAL/Functional/ConnectionTest.php b/test/Crate/Test/DBAL/Functional/ConnectionTest.php index cd7687c..044f0b9 100644 --- a/test/Crate/Test/DBAL/Functional/ConnectionTest.php +++ b/test/Crate/Test/DBAL/Functional/ConnectionTest.php @@ -24,7 +24,7 @@ use Crate\PDO\PDOCrateDB; use Crate\Test\DBAL\DBALFunctionalTestCase; -class ConnectionTestCase extends DBALFunctionalTestCase +class ConnectionTest extends DBALFunctionalTestCase { public function setUp() : void { @@ -49,7 +49,7 @@ public function testBasicAuthConnection() 'password' => $auth[1], ); $conn = \Doctrine\DBAL\DriverManager::getConnection($params); - $this->assertEquals($auth[0], $conn->getParams()['username']); + $this->assertEquals($auth[0], $conn->getParams()['user']); $this->assertEquals($auth[1], $conn->getParams()['password']); $auth_attr = $conn->getWrappedConnection()->getAttribute(PDOCrateDB::CRATE_ATTR_HTTP_BASIC_AUTH); $this->assertEquals($auth_attr, $auth); @@ -82,7 +82,7 @@ public function testConnect() $stmt = $this->_conn->executeQuery('select * from sys.cluster'); $this->assertEquals(1, $stmt->rowCount()); - $row = $stmt->fetchOne(); + $row = $stmt->fetchAssociative(); $this->assertEquals('crate', $row['name']); } diff --git a/test/Crate/Test/DBAL/Functional/DataAccessTest.php b/test/Crate/Test/DBAL/Functional/DataAccessTest.php index 3c6e90d..69adec4 100644 --- a/test/Crate/Test/DBAL/Functional/DataAccessTest.php +++ b/test/Crate/Test/DBAL/Functional/DataAccessTest.php @@ -34,7 +34,7 @@ use PDO; -class DataAccessTestCase extends DBALFunctionalTestCase +class DataAccessTest extends DBALFunctionalTestCase { static private $generated = false; @@ -164,7 +164,7 @@ public function testPrepareWithFetchAllBoth() $stmt->bindParam(2, $paramStr, PDO::PARAM_STR); $result = $stmt->executeQuery(); - $rows = $result->fetchAllAssociative(); + $rows = $result->fetchAll(PDO::FETCH_BOTH); $rows[0] = array_change_key_case($rows[0], \CASE_LOWER); $this->assertEquals(array('test_int' => 1, 'test_string' => 'foo', 0 => 1, 1 => 'foo'), $rows[0]); } @@ -296,7 +296,7 @@ public function testFetchColumn() $this->assertEquals(1, $testInt); $sql = "SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"; - $testString = $this->_conn->fetchOne($sql, array(1, 'foo')); + $testString = $this->_conn->fetchColumn($sql, array(1, 'foo'), 1); $this->assertEquals('foo', $testString); } @@ -485,7 +485,7 @@ public function testFetchAllStyleColumn() $this->refresh("fetch_table"); $sql = "SELECT test_int FROM fetch_table ORDER BY test_int ASC"; - $rows = $this->_conn->executeQuery($sql)->fetchOne(); + $rows = $this->_conn->executeQuery($sql)->fetchAll(PDO::FETCH_COLUMN); $this->assertEquals(array(1, 10), $rows); } diff --git a/test/Crate/Test/DBAL/Functional/WriteTest.php b/test/Crate/Test/DBAL/Functional/WriteTest.php index 36bfe0b..0e10b32 100644 --- a/test/Crate/Test/DBAL/Functional/WriteTest.php +++ b/test/Crate/Test/DBAL/Functional/WriteTest.php @@ -82,9 +82,9 @@ public function testExecuteUpdateFirstTypeIsNull() $this->refresh('write_table'); $sql = "SELECT test_obj, test_string, test_int FROM write_table WHERE test_string = ? AND test_int = ?"; - $this->assertEquals($this->_conn->fetchOne($sql, array("text", 1111)), null); - $this->assertEquals($this->_conn->fetchOne($sql, array("text", 1111)), "text"); - $this->assertEquals($this->_conn->fetchOne($sql, array("text", 1111)), 1111); + $this->assertEquals($this->_conn->fetchColumn($sql, array("text", 1111)), null); + $this->assertEquals($this->_conn->fetchColumn($sql, array("text", 1111), 1), "text"); + $this->assertEquals($this->_conn->fetchColumn($sql, array("text", 1111), 2), 1111); } public function testExecuteUpdate() diff --git a/test/Crate/Test/DBAL/Platforms/CratePlatformTest.php b/test/Crate/Test/DBAL/Platforms/CratePlatformTest.php index fe92861..628908d 100644 --- a/test/Crate/Test/DBAL/Platforms/CratePlatformTest.php +++ b/test/Crate/Test/DBAL/Platforms/CratePlatformTest.php @@ -38,6 +38,7 @@ use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Doctrine\Tests\DBAL\Platforms\AbstractPlatformTestCase; +use Doctrine\Tests\DBAL\Platforms\GetAlterTableSqlDispatchEventListener; class CratePlatformTest extends AbstractPlatformTestCase { @@ -402,11 +403,15 @@ public function testGeneratesTableAlterationSql() : void public function testGetAlterTableSqlDispatchEvent() : void { $events = array( - 'onSchemaAlterTableAddColumn' + 'onSchemaAlterTableAddColumn', + 'onSchemaAlterTableChangeColumn', + 'onSchemaAlterTableRemoveColumn', + 'onSchemaAlterTableRenameColumn', + 'onSchemaAlterTable' ); - $listenerMock = $this->getMockBuilder('GetAlterTableSqlDispatchEvenListener') - ->addMethods($events) + $listenerMock = $this->getMockBuilder(GetAlterTableSqlDispatchEventListener::class) + ->onlyMethods($events) ->getMock(); $listenerMock ->expects($this->once())