/** * @test */ public function shouldConnect() { // Fixture $this->configMock->method('__get')->with('db')->will($this->returnValue((object) ['dsn' => 'sqlite::memory:', 'username' => '', 'password' => ''])); // Test $actual = $this->target->connect($this->configMock); // Assert $this->assertTrue($actual); }
/** * @test */ public function shouldFetchAll() { // Fixture $this->target->query('SELECT * FROM names'); // Test $actual = $this->target->fetchAll(); // Assert $this->assertEquals([(object) ['id' => 1, 'name' => 'Alice']], $actual); }
/** * @test */ public function shouldFetchAll() { // Fixture $rows = [(object) ['id' => 1, 'name' => 'Alice']]; $this->pdoBackendMock->method('fetchAll')->will($this->returnValue($rows)); // Test $actual = $this->target->fetchAll(); // Assert $this->assertSame($rows, $actual); }