public function updateSetting($userId, $type, $flag) { $columnName = $this->getFlagColomunName($type); return !!$this->mailNotify->update([$columnName => $flag === 'true' ? 1 : 0], ['user_id' => $userId]); }
public function testShouldReturnUpdateResult() { $this->userMailNotifyCriteria->shouldReceive('update')->andReturn(true); $service = new MailNotifyService($this->userMailNotifyCriteria); $this->assertTrue($service->updateSetting(1235, 'comment', 0)); }