Skip to content

Commit d9475e6

Browse files
committed
Fix tests
1 parent 863747e commit d9475e6

16 files changed

+19
-5
lines changed

docker/debian9/run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
2+
PHP=$(php -r 'echo explode("-",phpversion())[0];')
23
echo "================================================"
3-
echo " Debian 9"
4+
echo " Debian 9 (PHP $PHP)"
45
echo "================================================"
56

67
echo -n "[1/4] Starting MariaDB 10.1 ..... "

docker/ubuntu16/run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
2+
PHP=$(php -r 'echo explode("-",phpversion())[0];')
23
echo "================================================"
3-
echo " Ubuntu 16.04"
4+
echo " Ubuntu 16.04 (PHP $PHP)"
45
echo "================================================"
56

67
echo -n "[1/4] Starting MariaDB 10.0 ..... "

docker/ubuntu18/run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
2+
PHP=$(php -r 'echo explode("-",phpversion())[0];')
23
echo "================================================"
3-
echo " Ubuntu 18.04"
4+
echo " Ubuntu 18.04 (PHP $PHP)"
45
echo "================================================"
56

67
echo -n "[1/4] Starting MySQL 5.7 ........ "

src/Tqdev/PhpCrudApi/Column/Reflection/ReflectedColumn.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ public function isGeometry(): bool
124124
return $this->type == 'geometry';
125125
}
126126

127+
public function isInteger(): bool
128+
{
129+
return in_array($this->type, ['integer', 'bigint', 'smallint', 'tinyint']);
130+
}
131+
127132
public function setPk($value) /*: void*/
128133
{
129134
$this->pk = $value;

src/Tqdev/PhpCrudApi/Database/DataConverter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ private function convertRecordValue($conversion, $value)
1818
switch ($conversion) {
1919
case 'boolean':
2020
return $value ? true : false;
21+
case 'integer':
22+
return (int) $value;
2123
}
2224
return $value;
2325
}
@@ -27,6 +29,9 @@ private function getRecordValueConversion(ReflectedColumn $column): String
2729
if (in_array($this->driver, ['mysql', 'sqlsrv']) && $column->isBoolean()) {
2830
return 'boolean';
2931
}
32+
if ($this->driver == 'sqlsrv' && $column->getType() == 'bigint') {
33+
return 'integer';
34+
}
3035
return 'none';
3136
}
3237

src/Tqdev/PhpCrudApi/Database/GenericDB.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ private function getOptions(): array
5959
\PDO::ATTR_PERSISTENT => true,
6060
];
6161
case 'sqlsrv':return $options + [
62+
\PDO::SQLSRV_ATTR_DIRECT_QUERY => false,
6263
\PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE => true,
6364
];
6465
}

tests/fixtures/blog_mysql.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ CREATE TABLE `products` (
125125
`id` int(11) NOT NULL AUTO_INCREMENT,
126126
`name` varchar(255) NOT NULL,
127127
`price` decimal(10,2) NOT NULL,
128-
`properties` JSON NOT NULL,
128+
`properties` longtext NOT NULL,
129129
`created_at` datetime NOT NULL,
130130
`deleted_at` datetime NULL,
131131
PRIMARY KEY (`id`)

tests/fixtures/blog_sqlsrv.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ GO
202202

203203
CREATE VIEW [tag_usage]
204204
AS
205-
SELECT top 100 PERCENT name, COUNT(name) AS [count] FROM tags, post_tags WHERE tags.id = post_tags.tag_id GROUP BY name ORDER BY [count] DESC, name
205+
SELECT top 100 PERCENT name, COUNT_BIG(name) AS [count] FROM tags, post_tags WHERE tags.id = post_tags.tag_id GROUP BY name ORDER BY [count] DESC, name
206206
GO
207207

208208
CREATE TABLE [products](

0 commit comments

Comments
 (0)