public function testGetColumnCells() { $columnIndex = 1; // which column to get for our test $count = 10; $rows = array(); for ($i = 0; $i < $count; $i++) { $row = new TableRow(); $row->addCell(new TableCell(new TextValue('a' . $i))); $row->addCell(new TableCell(new TextValue('b' . $i))); $rows[] = $row; } $data = new DataTable(); $data->addColumn(new ColumnDescription('c0', ValueType::STRING)); $data->addColumn(new ColumnDescription('c1', ValueType::STRING)); $cells = $data->getColumnCells(0); $this->assertSame(0, count($cells), "cells must be an empty array when no rows exist"); $data->addRows($rows); $cells = $data->getColumnCells($columnIndex); $this->assertSame($count, count($cells), "cells must contain an entry for every row of data"); for ($i = 0; $i < $count; $i++) { $inputCell = $rows[$i]->getCell($columnIndex); $this->assertEquals($inputCell, $cells[$i], "Cell[{$i}] must match input data"); } }