- $tag = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Tag')
- ->disableOriginalConstructor()
- ->getMock();
-
- $tagRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
- ->disableOriginalConstructor()
- ->getMock();
-
- $tagRepo->expects($this->exactly(2))
- // the method `findOneByLabel` doesn't exist, EntityRepository will then call `_call` method
- // to magically call the `findOneBy` with ['label' => 'foo']
- ->method('__call')
- ->will($this->onConsecutiveCalls(false, $tag));
-