29 $this->
dbManager->setDriver($this->driver);
37 function testInsertTableRow()
40 $assocParams = array(
'cola'=>1,
'colb'=>2);
42 $preSql =
"INSERT INTO $tableName (cola,colb) VALUES ($1,$2)";
43 $this->driver->shouldReceive(
'prepare')->with($sqlLog,$preSql)->once();
44 $this->driver->shouldReceive(
'execute')->with($sqlLog,array_values($assocParams))->once();
45 $this->driver->shouldReceive(
'freeResult');
46 $this->
dbManager->insertTableRow($tableName,$assocParams,$sqlLog);
49 function testCreateMap()
55 $preSql =
"/ $keyColumn, *$valueColumn /";
56 $this->driver->shouldReceive(
'prepare')->with($sqlLog,\Mockery::pattern($preSql))->once();
57 $this->driver->shouldReceive(
'execute')->andReturn(
'fakeRes');
58 $this->driver->shouldReceive(
'fetchArray')->andReturn(
59 array($keyColumn=>
'k0',$valueColumn=>
'v0'),
60 array($keyColumn=>
'k1',$valueColumn=>
'v1'),
63 $this->driver->shouldReceive(
'freeResult');
64 $map = $this->
dbManager->createMap($tableName,$keyColumn,$valueColumn,$sqlLog);
65 assertThat($map,hasKey(
'k0'));
66 assertThat($map,EqualTo(array(
'k0'=>
'v0',
'k1'=>
'v1')));
fo_dbManager * dbManager
fo_dbManager object