Closed zerkms closed 6 years ago
I am also facing with the same issue. Unit tests are failing because of the new implementation.
I am having the same issue in the latest phpunit. In phpunit 3.7.28 its ignoring type for comparison. But its doing type check now.
Using createQueryTable to get the data from db and using PHPUnit_Extensions_Database_DataSet_XMLDataSet to get data from xml file. The one from DB returns with the correct type, but one from xml, all are strings. So when using $this->assertThat it fails.
Related: #107
My proposal: to use xml namespaces to express the data type so that DataSet
class might convert it explicitly.
Examples:
bool:foo="true"
bool:foo="1"
bool:foo="no"
int:bar="42"
If dbunit dev team is interested - I might allocate some time to it and implement.
I ended up migrating to yml datasets since src/DataSet/XmlDataSet.php#L67 still contains its (string)
casting magic.
I changed to YAML after hairmare's suggestion but was still experiencing problems with PostgresSQL, eventually having to use PostgresSQL standard which is effectively a one char string in YAML, e.g.
name: "Michael Moore"
filmmaker: t
athletic: f
This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions.
In another pull request it was added a special case for comparing numeric values: https://github.com/sebastianbergmann/dbunit/commit/94e8237bb516889164b40a22da13aaa0c88a0c9f#diff-ff8d2de4c53f9d6000d6c4dbb9c90c34R167
But the thing is that database driver (PDO pgsql in my case) might also return booleans.
And since there is no way to specify a boolean value in a fixture file (they all are treated as strings) - the comparison
$thisValue !== $otherValue
is always evaluated tofalse
.