Skip to content

Instantly share code, notes, and snippets.

@gries
Created January 11, 2012 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gries/1593659 to your computer and use it in GitHub Desktop.
Save gries/1593659 to your computer and use it in GitHub Desktop.
mocking a doctrine getter the right way
<?php
class fooTest extends PHPUnit_Framework_TestCase
{
public function testBar()
{
$builder = $this->getMockBuilder('SomeDoctrineRecordClass')->disableOriginalConstructor();
$mockObject = $builder->getMock();
$mockObject->expects($this->any())
->method('__call')
->with($this->equalTo('getProperty'), $this->anything())
->will($this->returnValue(true));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment