public function testCreateRow() { $this->_client->expects($this->any())->method('getPrimaryKey')->will($this->returnValue('id')); $model = new Kwf_Model_Service(array('client' => $this->_client)); $newRow = $model->createRow(array('name' => 'foo', 'type' => 'bar')); $this->assertEquals('foo', $newRow->name); $this->assertEquals('bar', $newRow->type); }
public function testCreateSetId() { $this->_client->expects($this->once())->method('rowSave')->with(null, $this->equalTo(array('id' => 29, 'firstname' => 'Herbert', 'lastname' => 'Huber')))->will($this->returnValue(array('id' => 29, 'firstname' => 'Herbert', 'lastname' => 'Huber'))); $model = new Kwf_Model_Service(array('client' => $this->_client)); $row = $model->createRow(); $row->id = 29; $row->firstname = 'Herbert'; $row->lastname = 'Huber'; $row->save(); $this->assertEquals(29, $row->id); $this->assertEquals('Herbert', $row->firstname); $this->assertEquals('Huber', $row->lastname); }