public function testUpdateAfterInsert() { $obj = new Book($this->conn); $obj->name = 'foo'; $obj->description = 'bar'; $this->conn->expects($this->once())->method('insert')->with('books', ['name' => 'foo', 'description' => 'bar']); $this->conn->expects($this->once())->method('lastInsertId')->will($this->returnValue(42)); $obj->insert(); $obj->description = 'baz'; $this->conn->expects($this->once())->method('update')->with('books', ['description' => 'baz'], ['id' => 42]); $obj->update(); }