コード例 #1
0
ファイル: MysqlTest.php プロジェクト: okite11/frames21
 public function testInsertRecords()
 {
     $data = [['column1' => 'value1'], ['column1' => 'value2']];
     $pdoMock = $this->getMock('\\PdoTest', ['prepare', 'execute'], [], '', false);
     $pdoMock->expects($this->any())->method('prepare')->willReturnSelf();
     $pdoMock->expects($this->any())->method('execute')->willReturnSelf();
     $this->pdoMysql->expects($this->any())->method('getConnection')->willReturn($pdoMock);
     $this->assertEquals(2, $this->adapterMysql->insertRecords('some_table', $data));
 }
コード例 #2
0
 public function testInsertRecords()
 {
     $data = [['column1' => 'value1'], ['column1' => 'value2']];
     $this->pdoMysql->expects($this->any())->method('insertMultiple')->with($this->equalTo('some_table'), $this->equalTo($data))->willReturn(2);
     $this->assertEquals(2, $this->adapterMysql->insertRecords('some_table', $data));
 }