/** * @param string $text * @return ContainerInterface */ private static function makeContainer($text) { $tokenizer = new TokenizerEn(); $builder = new ContainerBuilderDefault($tokenizer); $container = $builder->build($text); return $container; }
/** * @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); }
/** * @dataProvider notStringDataProvider * @expectedException \InvalidArgumentException */ public function testBuildFailsOnInvalidSourceData($sourceData) { $tokenizer = static::getMock('\\Mufuphlex\\Textonic\\Tokenizer\\TokenizerInterface'); $builder = new ContainerBuilderDefault($tokenizer); $builder->build($sourceData); }