public function __construct(Configuration $configuration, $writerId, $tableId) { $this->configuration = $configuration; $storageApi = $this->configuration->getStorageApi(); $sysBucket = $this->configuration->getSysBucketId($writerId); $this->tableId = $tableId; $tableName = $configuration->getWriterTableName($tableId); parent::__construct($storageApi, $sysBucket . '.' . $tableName); }
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); } }