adamquaile / behat-table-parser

此软件包的最新版本(dev-master)没有可用的许可证信息。

dev-master 2015-02-22 18:39 UTC

This package is auto-updated.

Last update: 2024-08-25 07:00:03 UTC


README

为behat TableNodes提供更流畅的API。

实验性。需要实现更好的方法将其集成到上下文类中。

使用方法

用于单个实体或键值对的表格

Given there is a table like this:
| Key1 | Value1 |
| Key2 | Value2 |

和一个上下文方法,例如这样的(即将实现)

public function thereIsATableLikeThis(TableNode $table)
{
    $table = (new SingleEntryTable($table))
        ->requires('Key1')
    ;
    $table->get('Key1');
}

(即将实现)用于多个实体的表格

Given there is a table like this:
| Key1          | Key 2         | Key 3         |
| 1st Value 1   | 1st Value 2   | 1st Value 3   |
| 2nd Value 1   | 2nd Value 2   | 2nd Value 3   |
| 3rd Value 1   | 3rd Value 2   | 3rd Value 3   |

和一个上下文方法,例如这样的(即将实现)

public function thereIsATableLikeThis(TableNode $table)
{
    $table = (new MultipleEntityTable($table))
        ->requires('Key1')
        ->requires('Key2')
    ;
    $table->each(function() { ... });
    $table->row(0)->get('Key1')
}