/** * @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); }
public function setUp() { $this->configMock = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->getMock(); $this->configMock->method('__get')->with('db')->will($this->returnValue((object) ['dsn' => 'sqlite::memory:', 'username' => '', 'password' => ''])); $this->target = new PdoBackend(); $this->target->connect($this->configMock); $this->target->query('CREATE TABLE names(id INTEGER PRIMARY KEY, name VARCHAR(10));'); $this->target->query('INSERT INTO names(id, name) VALUES (NULL, "Alice");'); }