2017 © Pedro Peláez
 

library behat-table-comparison

Provides an equality assertion for comparing Behat TableNode tables.

image

traviscarden/behat-table-comparison

Provides an equality assertion for comparing Behat TableNode tables.

  • Tuesday, July 3, 2018
  • by TravisCarden
  • Repository
  • 0 Watchers
  • 4 Stars
  • 7,245 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 6 Versions
  • 77 % Grown

The README.md

Behat Table Comparison

Packagist Build Status Coverage Status, (*1)

The Behat Table Comparison library provides an equality assertion for comparing Behat TableNode tables., (*2)

Installation & Usage

Install the library via Composer:, (*3)

composer require --dev traviscarden/behat-table-comparison

Then use the TableEqualityAssertion class in your FeatureContext class:, (*4)

<?php

use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\TableNode;
use TravisCarden\BehatTableComparison\TableEqualityAssertion;

class FeatureContext implements Context
{

    /**
     * @Then I should include the following characters in the Company of the Ring
     */
    public function iShouldIncludeTheFollowingCharactersInTheCompanyOfTheRing(TableNode $expected)
    {
        // Get the data from the application and create a table from it.
        $application_data = [
            ['Frodo Baggins', 'Hobbit'],
            ['Samwise "Sam" Gamgee', 'Hobbit'],
            ['Saruman the White', 'Wizard'],
            ['Legolas', 'Elf'],
            ['Gimli', 'Dwarf'],
            ['Aragorn (Strider)', 'Man'],
            ['Boromir', 'Man'],
            ['Meriadoc "Merry" Brandybuck', 'Hobbit'],
            ['Peregrin "Pippin" Took', 'Hobbit'],
        ];
        $actual = new TableNode($application_data);

        // Build and execute assertion.
        (new TableEqualityAssertion($expected, $actual))
            ->expectHeader(['name', 'race'])
            ->ignoreRowOrder()
            ->setMissingRowsLabel('Missing characters')
            ->setUnexpectedRowsLabel('Unexpected characters')
            ->assert();
    }

}

Output is like the following:, (*5)

Example Output, (*6)

Examples

See features/bootstrap/FeatureContext.php and features/examples.feature for more examples., (*7)

Limitations & Known Issues

Some inequality detection currently works but does not yet display a helpful error message, because it has not been decided what it should show. Please help me specify error messages for complex differences., (*8)

Contribution

All contributions are welcome according to normal open source practice., (*9)

The Versions

03/07 2018

dev-master

9999999-dev

Provides an equality assertion for comparing Behat TableNode tables.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Carden

behat gherkin

03/07 2018

v0.2.2

0.2.2.0

Provides an equality assertion for comparing Behat TableNode tables.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Carden

behat gherkin

23/02 2017

v0.2.1

0.2.1.0

Provides an equality assertion for comparing Behat TableNode tables.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Carden

behat gherkin

08/02 2017

v0.2.0

0.2.0.0

Provides an equality assertion for comparing Behat TableNode tables.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Carden

behat gherkin

03/02 2017

v0.1.1

0.1.1.0

Provides an equality assertion for comparing Behat TableNode tables.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Carden

behat gherkin

02/02 2017

v0.1.0

0.1.0.0

Provides an equality assertion for comparing Behat TableNode tables.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Travis Carden

behat gherkin