public function testUpdate() { $agreement = $this->getMock('Magento\\Paypal\\Model\\Billing\\Agreement', [], [], '', false); $argument = $this->getMock('Magento\\Sales\\Model\\ResourceModel\\Order\\Collection', [], [], '', false); $this->_registry->expects($this->once())->method('registry')->with('current_billing_agreement')->will($this->returnValue($agreement)); $agreement->expects($this->once())->method('getId')->will($this->returnValue('agreement id')); $this->_agreementResource->expects($this->once())->method('addOrdersFilter')->with($this->identicalTo($argument), 'agreement id'); $this->assertSame($argument, $this->_model->update($argument)); }