/** * @param string $value * @param int $enumCode * @param array $options * @return string */ public function __invoke($value, $enumCode, array $options = null) { $enumCode = (int) $enumCode; $row = $this->enumManager->get($enumCode, $value); if (null === $row) { if (isset($options['default'])) { return $options['default']; } return null; } $mode = EnumManager::LONG; if (isset($options['mode']) && in_array($options['mode'], $this->validMode)) { $mode = (string) $options['mode']; } return $row[$mode]; }
public function testGetLongNameFromEnumDoesNotExists() { $adapter = $this->createMock('Enum\\Adapter\\AdapterInterface'); $adapter->expects($this->any())->method('get')->will($this->returnValue($this->getDataset())); $manager = new EnumManager($adapter); $this->assertEquals(4, $manager->getLongName(1, 4)); }