<?php
use PHPUnit\Framework\TestCase;
use PHPUnit\DbUnit\TestCaseTrait;
use PHPUnit\DbUnit\DataSet\ArrayDataSet;
class Test extends TestCase
{
use TestCaseTrait;
public function getConnection()
{
$pdo = new PDO('sqlite::memory:');
return $this->createDefaultDBConnection($pdo, ':memory:');
}
public function getDataSet()
{
return new ArrayDataSet([]);
}
public function testOne()
{
$this->assertDataSetsEqual(
new ArrayDataSet(
[
'empty_table' => [
],
'not_empty_table' => [
['foo' => 'bar']
]
]
),
new ArrayDataSet(
[
'empty_table' => [
],
'not_empty_table' => [
['foo' => 'baz']
]
]
)
);
}
}
Actual Result
PHPUnit 6.4.3 by Sebastian Bergmann and contributors.
F 1 / 1 (100%)
Time: 33 ms, Memory: 4.00MB
There was 1 failure:
1) Test::testOne
Failed asserting that
+
| empty_table |
+
|
+
+----------------------+
| not_empty_table |
+----------------------+
| foo |
+----------------------+
| baz |
+----------------------+
is equal to expected
+
| empty_table |
+
|
+
(table diff enabled)
+----------------------+
| not_empty_table |
+----------------------+
| foo |
+----------------------+
| 'bar' != actual 'baz |
+----------------------+
.
/home/sb/Test.php:36
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
Expected Result
PHPUnit 6.4.3 by Sebastian Bergmann and contributors.
F 1 / 1 (100%)
Time: 33 ms, Memory: 4.00MB
There was 1 failure:
1) Test::testOne
Failed asserting that
+-------------+
| empty_table |
+-------------+
+----------------------+
| not_empty_table |
+----------------------+
| foo |
+----------------------+
| baz |
+----------------------+
is equal to expected
+-------------+
| empty_table |
+-------------+
(table diff enabled)
+----------------------+
| not_empty_table |
+----------------------+
| foo |
+----------------------+
| 'bar' != actual 'baz |
+----------------------+
.
/home/sb/Test.php:36
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
Actual Result
Expected Result