public function tearDown() { // Delete local files $finder = new Finder(); $fs = new Filesystem(); $fs->remove($finder->files()->in($this->tmpDir . "/download")); $fs->remove($finder->files()->in($this->tmpDir)); $fs->remove($this->tmpDir . "/download"); $fs->remove($this->tmpDir); // Delete file uploads $options = new ListFilesOptions(); $options->setTags(["docker-bundle-test"]); $files = $this->client->listFiles($options); foreach ($files as $file) { $this->client->deleteFile($file["id"]); } if ($this->client->bucketExists("in.c-docker-test")) { // Delete tables foreach ($this->client->listTables("in.c-docker-test") as $table) { $this->client->dropTable($table["id"]); } // Delete bucket $this->client->dropBucket("in.c-docker-test"); } if ($this->client->bucketExists("in.c-docker-test-redshift")) { // Delete tables foreach ($this->client->listTables("in.c-docker-test-redshift") as $table) { $this->client->dropTable($table["id"]); } // Delete bucket $this->client->dropBucket("in.c-docker-test-redshift"); } }
/** */ public function testWriteFilesOutputMappingAndManifest() { $root = $this->tmp->getTmpFolder(); file_put_contents($root . "/upload/file1", "test"); file_put_contents($root . "/upload/file1.manifest", "tags: [\"tde-exporter-php-test\", \"xxx\"]\nis_public: true"); $configs = array(array("source" => "file1", "tags" => array("tde-exporter-php-test", "yyy"), "is_public" => false)); $writer = new Uploader($this->client); $writer->uploadFiles($root . "/upload", $configs); $options = new ListFilesOptions(); $options->setTags(array("tde-exporter-php-test")); $files = $this->client->listFiles($options); $this->assertCount(1, $files); $file1 = null; foreach ($files as $file) { if ($file["name"] == 'file1') { $file1 = $file; } } $this->assertNotNull($file1); $this->assertEquals(4, $file1["sizeBytes"]); $this->assertEquals(array("tde-exporter-php-test", "yyy"), $file1["tags"]); $this->assertFalse($file1["isPublic"]); }