/** @test */ public function it_registers_a_table_gateway_and_returns_it_upon_request() { $tableGatewayInstance = TableGatewayFactory::create('people', new Dsn('memory')); TableGatewayFactory::register('people', $tableGatewayInstance); $tableGateway = TableGatewayFactory::get('people'); $this->assertEquals($tableGatewayInstance, $tableGateway); }
/** @test */ public function it_selects_records_with_query() { $this->table = TableGatewayFactory::get('people'); $this->insertRows([['firstName' => 'John', 'lastName' => 'Doe'], ['firstName' => 'Jane', 'lastName' => 'Doe'], ['firstName' => 'Bob', 'lastName' => 'Doe']]); $result = $this->table->select(['columns' => ['firstName'], 'where' => ['lastName' => 'Doe'], 'limit' => 1, 'offset' => 1, 'order' => ['firstName' => 'asc']]); $this->assertEquals([['firstName' => 'Jane']], $result); }