Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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);
 }