public function testEmailRmByClient() { $service = new \Box\Mod\Email\Service(); $di = new \Box_Di(); $model = new \Model_ActivityClientEmail(); $model->loadBean(new \RedBeanPHP\OODBBean()); $db = $this->getMockBuilder('Box_Database')->getMock(); $db->expects($this->atLeastOnce())->method('find')->will($this->returnValue(array($model))); $db->expects($this->atLeastOnce())->method('trash')->will($this->returnValue(null)); $di['db'] = $db; $service->setDi($di); $client = new \Model_Client(); $client->loadBean(new \RedBeanPHP\OODBBean()); $client->id = 1; $result = $service->rmByClient($client); $this->assertTrue($result); }