Backend\Modules\Extensions\Tests\UploadThemeTest::testUploadThemeNoParentFolder PHP Method

testUploadThemeNoParentFolder() public method

Test if we can upload a theme with a zip that contains only the files (not wrapped in a parent folder).
    public function testUploadThemeNoParentFolder()
    {
        // Generate zip with no info.xml
        $this->fileName = tempnam(sys_get_temp_dir(), 'Theme');
        $filePath = $this->fileName . '.zip';
        $baseName = self::THEME_NAME;
        $archive = new ZipArchive();
        $archive->open($filePath, ZipArchive::CREATE);
        $archive->addFromString('info.xml', $this->getSampleInfoXmlContents($baseName));
        $archive->close();
        if (file_exists($archive->filename)) {
            throw new FileNotFoundException('Could not create zip file with theme');
        }
        $this->submitThemeUploadForm();
        // We should get a 200 and be redirected to the themes index page.
        self::assertEquals(200, $this->client->getResponse()->getStatusCode());
        self::assertContains(self::URL_THEMES_INDEX, $this->client->getHistory()->current()->getUri());
        self::assertContains(self::THEME_NAME, $this->client->getResponse()->getContent());
    }