/**
  * 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'))->addArgument('%serverTime%')->setShared(false);
     $container->register('predmety.controller.class', '\\fajr\\controller\\predmety\\PredmetyController')->addArgument(new sfServiceReference('register_predmetov_screen.factory.class'))->addArgument('%serverTime%')->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('register_predmetov_screen.factory.class', '\\fajr\\libfajr\\pub\\window\\VSST060_register_predmetov\\VSST060_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\libfajr\pub\regression\fake_data\FakeData::getDirectory()));
             $container->register('AIS2MainScreen.class', '\\fajr\\libfajr\\window\\fake\\FakeMainScreen')->setShared(false);
             /**
              * Somewhat arbitrary fixed as 10.1.2011 12:17:53
              **/
             $FAKE_TIME = mktime(12, 17, 53, 1, 10, 2011);
             $container->setParameter('serverTime', $FAKE_TIME);
             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('register_predmetov_screen.factory.class', '\\fajr\\libfajr\\pub\\window\\VSST060_register_predmetov\\VSST060_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);
             $container->setParameter('serverTime', time());
             break;
         default:
             assert(false);
     }
 }
 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' => FakeData::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, $time);
     $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 = FakeData::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);
     }
 }