public function testAddToken() { $token = 'token'; $container = static::getMock('\\Mufuphlex\\Cplt\\ContainerInterface'); $container->expects(static::once())->method('addToken')->with($token); $cache = static::getMock('\\Mufuphlex\\Cache\\CacheInterface'); $container = new DecoratorCached($container, $cache); $container->addToken($token); }
/** * @param $port * @return DaemonInterface */ function getNamespacedDemoDaemon($port) { $tokenizer = new TokenizerEn(); $builder = new ContainerBuilderDefault($tokenizer); $container = $builder->build(''); $container = new DecoratorCached($container, new CachePhpNative()); $tokens = array('animals' => array('cat', 'dog', 'bat'), 'furniture' => array('table', 'chair', 'bed'), 'stationary' => array('pen', 'pencil')); foreach ($tokens as $namespace => $data) { foreach ($data as $item) { $container->addToken($item, $namespace); } } return getContainerDaemon($container, $port); }