Something like this ???:
```
$phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$phpbb_container->expects($this->any())
	 ->method('get')
	 ->will($this->returnCallback(function() use ($db) {
		return new \ext\phpbb\boardrules\entity\rule($db, 'phpbb_boardrules');
	})
);
```