示例#1
0
 /**
  * @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);
 }
示例#2
0
 /**
  * @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);
 }
示例#3
0
文件: DbTest.php 项目: etu/php-tools
 /**
  * @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);
 }