Example #1
0
 public function logout()
 {
     $this->client->setServerParameters(array());
     $this->client->getCookieJar()->clear();
     $this->user = null;
     $this->pageEleveur = null;
 }
 protected function setUp()
 {
     static::$client = static::createClient();
     $container = static::$client->getContainer();
     $sapiToken = $container->getParameter('storage_api.test.token');
     $sapiUrl = $container->getParameter('storage_api.test.url');
     static::$client->setServerParameters(array('HTTP_X-StorageApi-Token' => $sapiToken));
 }
 /**
  * Setup HTTP client, command runner and Storage API client for each test
  */
 protected function setUp()
 {
     $this->httpClient = static::createClient();
     $container = $this->httpClient->getContainer();
     if (!$this->storageApiToken) {
         $this->storageApiToken = $container->getParameter('storage_api.test.token');
     }
     $this->httpClient->setServerParameters(['HTTP_X-StorageApi-Token' => $this->storageApiToken]);
     $this->jobMapper = $container->get('syrup.elasticsearch.current_component_job_mapper');
     $application = new Application($this->httpClient->getKernel());
     $application->add(new JobCommand());
     $command = $application->find('syrup:run-job');
     $this->commandTester = new CommandTester($command);
     $this->storageApiClient = new StorageApiClient(['token' => $this->storageApiToken, 'url' => $container->getParameter('storage_api.test.url')]);
 }
 /**
  * {@inheritdoc}
  */
 protected static function createClient(array $options = array(), array $server = array())
 {
     static::bootKernel($options);
     $client = new Client(static::$kernel);
     $client->setServerParameters($server);
     return $client;
 }
 protected function setUp()
 {
     self::$client = static::createClient();
     $this->container = self::$client->getContainer();
     $sapiToken = $this->container->getParameter('storage_api.test.token');
     $sapiUrl = $this->container->getParameter('storage_api.test.url');
     self::$client->setServerParameters(array('HTTP_X-StorageApi-Token' => $sapiToken));
     $this->storageApi = new SapiClient(['token' => $sapiToken, 'url' => $sapiUrl, 'userAgent' => 'ex-db']);
     $this->manager = new Manager($this->storageApi, $this->componentName);
     // Cleanup
     $sysBucketId = $this->manager->getSysBucketId();
     $accTables = $this->storageApi->listTables($sysBucketId);
     foreach ($accTables as $table) {
         $this->storageApi->dropTable($table['id']);
     }
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function request($method, $uri, array $parameters = array(), array $files = array(), array $server = array(), $content = null, $changeHistory = true)
 {
     if (strpos($uri, 'http://') === false) {
         $uri = self::LOCAL_URL . $uri;
     }
     if ($this->getServerParameter('HTTP_X-WSSE', '') !== '' && !isset($server['HTTP_X-WSSE'])) {
         //generate new WSSE header
         parent::setServerParameters(WebTestCase::generateWsseAuthHeader());
     }
     return parent::request($method, $uri, $parameters, $files, $server, $content, $changeHistory);
 }
 protected function setUp()
 {
     self::$client = static::createClient();
     $container = self::$client->getContainer();
     $sapiToken = $container->getParameter('storage_api.test.token');
     $sapiUrl = $container->getParameter('storage_api.test.url');
     self::$client->setServerParameters(array('HTTP_X-StorageApi-Token' => $sapiToken));
     $this->storageApi = new SapiClient(['token' => $sapiToken, 'url' => $sapiUrl, 'userAgent' => $this->componentName]);
     $this->encryptor = $container->get('syrup.encryptor');
     $this->configuration = $container->get('ex_google_drive.configuration');
     $this->configuration->setStorageApi($this->storageApi);
     try {
         $this->configuration->create();
     } catch (\Exception $e) {
         // bucket exists
     }
     // Cleanup
     $sysBucketId = $this->configuration->getSysBucketId();
     $tableId = $sysBucketId . '.' . $this->accountId;
     if ($this->storageApi->tableExists($tableId)) {
         $this->storageApi->dropTable($tableId);
     }
 }
 protected function setUp($driver = null)
 {
     self::$client = static::createClient();
     $this->container = self::$client->getContainer();
     $sapiToken = $this->container->getParameter('storage_api.test.token');
     $sapiUrl = $this->container->getParameter('storage_api.test.url');
     self::$client->setServerParameters(['HTTP_X-StorageApi-Token' => $sapiToken]);
     $this->storageApi = new SapiClient(['token' => $sapiToken, 'url' => $sapiUrl, 'userAgent' => $this->componentName]);
     if ($driver != null) {
         $this->configuration = new Configuration($this->componentName . '-' . $driver, $this->storageApi, $driver);
     } else {
         $this->configuration = new Configuration($this->componentName, $this->storageApi);
     }
     // Cleanup
     $sysBucketId = $this->configuration->getSysBucketId($this->writerId);
     if ($this->storageApi->bucketExists($sysBucketId)) {
         $accTables = $this->storageApi->listTables($sysBucketId);
         foreach ($accTables as $table) {
             $this->storageApi->dropTable($table['id']);
         }
         $this->storageApi->dropBucket($sysBucketId);
     }
 }
 /**
  * Setup storage api from AbstractTest::storageApiToken
  */
 protected function setupStorageApi()
 {
     $this->httpClient->setServerParameters(array('HTTP_X-StorageApi-Token' => $this->storageApiToken));
     $this->storageApi = new StorageApiClient(array('token' => $this->storageApiToken, 'url' => TEST_ORCHESTRATOR_SAPI_URL));
     $this->token = new StorageApiToken($this->storageApi);
 }
 /**
  * Sets server parameters.
  *
  * @param array $server An array of server parameters
  *
  * @api
  */
 public function setServerParameters(array $server)
 {
     $this->subject->setServerParameters($server);
 }