Skip to content
This repository was archived by the owner on Dec 7, 2018. It is now read-only.
This repository was archived by the owner on Dec 7, 2018. It is now read-only.

Empty tables are not displayed correctly #195

@sebastianbergmann

Description

@sebastianbergmann
<?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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions