Sanpi\Behatch\Context\TableContext::theStColumnOfTheStRowInTheTableShouldContain PHP Method

theStColumnOfTheStRowInTheTableShouldContain() public method

Checks that the specified cell (column/row) of the table's body contains the specified text
public theStColumnOfTheStRowInTheTableShouldContain ( $colIndex, $rowIndex, $table, $text )
    public function theStColumnOfTheStRowInTheTableShouldContain($colIndex, $rowIndex, $table, $text)
    {
        $rowSelector = "{$table} tbody tr";
        $rows = $this->getSession()->getPage()->findAll('css', $rowSelector);
        if (!isset($rows[$rowIndex - 1])) {
            throw new \Exception("The row {$rowIndex} was not found in the '{$table}' table");
        }
        $row = $rows[$rowIndex - 1];
        $cols = $row->findAll('css', 'td');
        if (!isset($cols[$colIndex - 1])) {
            throw new \Exception("The column {$colIndex} was not found in the row {$rowIndex} of the '{$table}' table");
        }
        $actual = $cols[$colIndex - 1]->getText();
        $this->assertContains($text, $actual);
    }