/** * When table entries are passed then store them. */ public function testWhenTableEntriesArePassedThenStoreThem() { $input = [\Mockery::mock(Table::class), \Mockery::mock(Table::class)]; $instance = TableCollection::build($input); $helper = \ClassHelper::instance($instance); static::assertSame($input, $helper->entries); }
/** * When entries are set then return them as an array. */ public function testWhenEntriesAreSetThenReturnThemAsAnArray() { $tableInstance = \tests\unit\lib\Domain\Models\Table\ToArrayTest::getInstanceSample(); $tableArray = \tests\unit\lib\Domain\Models\Table\ToArrayTest::getArraySample(); $response = TableCollection::build([$tableInstance]); $expected = [$tableArray]; static::assertEquals($expected, $response->toArray()); }
/** * @return TableCollection */ public function getTables() { $tableNames = $this->gateway->getTableNames(); $length = count($tableNames); $listing = []; for ($i = 0; $i < $length; $i++) { $table = $this->getTableByName($tableNames[$i]); $listing[] = $table; } $collection = TableCollection::build($listing); return $collection; }