Answer the question
In order to leave comments, you need to log in
How to make Zend+SQLite+PHPUnit work with JSON?
The problem is the following. In production, we use PostgreSQL, which supports the JSON data type. Everything is great with it in tests, if we work with Symfony + Doctrine - it has its own custom types, which in tests do not require that the field in the database be specified as JSON. In other words, in tests we use SQLite, but for it Doctrine itself sees that it does not support JSON, creates fields of type string when mapping tables, and then works with them as if it were JSON, decoding or encoding it back and forth, where it is required.
But when we start working with Zend Expressive 3 + zendframework/zend-db, the problems start. We manually write the database config for SQLite in tests, where we cannot specify a JSON type field, and we have to use string. As a result, code like:
$row = $this->tableGateway->select(
static function (Select $select) use ($blah) {
$select->where->nest
->equalTo('blah', $blah)
->or
->equalTo('sum, 1);
}
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question