1

I use PHPUnit to test by PDO wrapper. One of my tests is an integration test that proves that the abstraction layer produces the right syntax, or binds PDOStatement in the right way, etc. For this, I use an in-memory SQLite database, and declare ext-pdo_sqlite as a dev-dependency of my project.

When Github Actions runs a build, dependencies all get installed, hinting that pdo_sqlite is present on the system. This is further confirmed by the fact that the connection succeeds. However, when I run an insert query to set up my database, I get the following error:

PDOException: SQLSTATE[HY000]: General error: 1 no such column: TRUE

The query looks like this:

INSERT INTO `persons` (`id`, `name`, `dob`, `weight`, `is_dev`, `teeth`) VALUES (NULL, 'Anton', '1987-11-03', 71.3, TRUE, 31)

Table creation is done with PDO like this:

$pdo->exec("CREATE TABLE `$tableName` (`id` int(6) PRIMARY KEY, `name` varchar(255), `dob` datetime, `weight` float(5), `is_dev` bool, `teeth` int(2))");

This only manifests on CI, and local tests pass fine - even on the same PHP version as CI.

Any ideas? Am I just missing something in the syntax? Could it be that GH Actions has only a dummy implementation of SQLite or something?

Note: This is an open source project, and you can see everything, including the failing build, in dhii/pdo-query#1.

XedinUnknown
  • 677
  • 9
  • 25
  • Is the database missing? Is there a `CREATE DATABASE` step before the INSERT? – Max Jan 18 '21 at 12:08
  • Yep. I added it to the question now, thanks! Also, like I mentioned, the same tests run and pass fine locally, so I would assume the difference is in the environment. That's why I was thinking that maybe GHA's SQLite is somehow different. – XedinUnknown Jan 18 '21 at 15:22
  • Added link to pull request also, if someone wants to take a closer look. – XedinUnknown Jan 18 '21 at 15:29

0 Answers0