0

I created a mock object as follows:

        $mock_kyc = $this->getMockBuilder('Group_KYC_Model')
            ->disableOriginalConstructor()
            ->setMethods(['api_record', '__get'])
            ->getMock();

I want to set the id of the mock_kyc object. How do I do that?

Can I just do $kyc->id = 12345;

Chris Hansen
  • 7,813
  • 15
  • 81
  • 165
  • Did you even try? Anyway see http://stackoverflow.com/questions/18558183/phpunit-mockbuilder-set-mock-object-internal-property – gontrollez Jun 29 '15 at 10:41

1 Answers1

0

Sure you can do

$mock_kyc->id = 12345;

If id is private / protected, setter should help.

Zdenek Machek
  • 1,758
  • 1
  • 20
  • 30