/** * Ensure that all fake data we use are valid FileStorage * data files. This should ensure, that fake backend and * other services depending on fake data will not encounter * broken data. */ public function testAllData() { $storage = new FileStorage(array("root_path" => "/")); $dir = fake_data::getDirectory(); $it = new RecursiveDirectoryIterator($dir); $nonrecursiveIt = new RecursiveIteratorIterator($it); $regexIt = new RegexIterator($nonrecursiveIt, '@\\.dat$@'); foreach ($regexIt as $file) { $this->assertTrue($file->isFile()); $key = $file->getPathname(); $key = preg_replace("@\\.dat\$@", "", $key); $data = $storage->read($key); $this->assertTrue(null !== $data); } }
public function setUp() { $this->response = new Response(); $this->requestParams = new MockInvocationParameters(); $time = mktime(0, 0, 0, 1, 8, 2010); $this->request = new Request($this->requestParams, $time); $this->context = new Context(); $this->context->setRequest($this->request); $this->context->setResponse($this->response); $temporary_storage = new MemoryStorage(); $permanent_storage = new FileStorage(array('root_path' => fake_data::getDirectory())); $this->storage = new TemporarilyModifiableStorage(array('permanent_storage' => $permanent_storage, 'temporary_storage' => $temporary_storage)); $this->context->setSessionStorage($this->storage); $factory = new VSES017_FakeFactoryImpl($this->storage); $this->controller = new StudiumController($factory); $this->storage->write('ais/aisApps', array(AIS2ApplicationEnum::ADMINISTRACIA_STUDIA)); }
/** * Ensure that all fake data we use are valid FileStorage * data files. This should ensure, that fake backend and * other services depending on fake data will not encounter * broken data. */ public function testAllData() { $dir = fake_data::getDirectory(); $storage = new FileStorage(array("root_path" => $dir . '/')); $it = new RecursiveDirectoryIterator($dir); $nonrecursiveIt = new RecursiveIteratorIterator($it); $regexIt = new RegexIterator($nonrecursiveIt, '@\\.dat$@'); foreach ($regexIt as $file) { $this->assertTrue($file->isFile()); $key = $file->getPathname(); assert(StrUtil::startsWith($key, $dir)); // remove $dir from beginning of $key $key = substr($key, strlen($dir)); $key = preg_replace("@\\.dat\$@", "", $key); $data = $storage->read($key); $this->assertTrue(null !== $data); } }
/** * Configure injection of arguments of controllers * * @param sfServiceContainerBuilder $container Symfony container to configure */ public function configure(sfServiceContainerBuilder $container) { $container->register('studium.controller.class', '\\fajr\\controller\\studium\\StudiumController')->addArgument(new sfServiceReference('administracia_studia_screen.factory.class'))->setShared(false); switch ($this->server->getBackendType()) { case ServerConfig::BACKEND_FAKE: $container->register('administracia_studia_screen.factory.class', '\\fajr\\libfajr\\pub\\window\\VSES017_administracia_studia\\VSES017_FakeFactoryImpl')->addArgument(new sfServiceReference('fake.storage.class'))->setShared(false); $container->register('fake.storage.class', '\\fajr\\libfajr\\storage\\TemporarilyModifiableStorage')->addArgument('%TempStorage.options%'); $container->setParameter('TempStorage.options', array('permanent_storage' => new sfServiceReference('fake.file.storage.class'), 'temporary_storage' => $this->storage)); $container->register('fake.file.storage.class', '\\fajr\\libfajr\\storage\\FileStorage')->addArgument('%Fake.FileStorage.options%'); $container->setParameter('Fake.FileStorage.options', array('root_path' => \fajr\regression\fake_data\fake_data::getDirectory())); $container->register('AIS2MainScreen.class', '\\fajr\\libfajr\\window\\fake\\FakeMainScreen')->setShared(false); break; case ServerConfig::BACKEND_LIBFAJR: $container->register('administracia_studia_screen.factory.class', '\\fajr\\libfajr\\pub\\window\\VSES017_administracia_studia\\VSES017_FactoryImpl')->addArgument(new sfServiceReference('serverConnection.class'))->setShared(false); $container->register('AIS2MainScreen.class', '\\fajr\\libfajr\\window\\AIS2MainScreenImpl')->addArgument(new sfServiceReference('serverConnection.class'))->setShared(false); $container->setService('serverConnection.class', $this->connection); break; default: assert(false); } }