public function __construct(Configuration $configuration, $accountId) { $this->configuration = $configuration; $storageApi = $this->configuration->getStorageApi(); $sysBucket = $this->configuration->getSysBucketId(); $this->accountId = $accountId; parent::__construct($storageApi, $sysBucket . '.' . $accountId); }
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' => 'ex-google-analytics']); /** @var Encryptor $encryptor */ $encryptor = $container->get('syrup.encryptor'); $this->configuration = new Configuration($this->componentName, $encryptor); $this->configuration->setStorageApi($this->storageApi); try { $this->configuration->create(); } catch (\Exception $e) { // bucket exists } // Cleanup $sysBucketId = $this->configuration->getSysBucketId(); $tableId = $sysBucketId . '.' . 'test'; if ($this->storageApi->tableExists($tableId)) { $this->storageApi->dropTable($tableId); } }