public function testGetLabel() { $collection = new TestedClass(); $this->string($collection->getLabel(29))->isEqualTo('Finistère')->string($collection['29'])->isEqualTo('Finistère')->exception(function () use($collection) { $collection->getLabel(1); })->isInstanceOf('\\InvalidArgumentException')->hasMessage('Code "1" invalid')->string($collection->getLabel(1, true))->isEqualTo('Ain'); }
public function departmentLabel($code) { try { return $this->departements->getLabel($code, true); } catch (\InvalidArgumentException $e) { return $this->translator->trans('report.company_departement.unknown'); } }