Backend\Modules\Extensions\Tests\UploadThemeTest::testUploadThemeZipWithoutInfoFile PHP Метод

testUploadThemeZipWithoutInfoFile() публичный Метод

Test that we cannot upload a theme without info.xml file
public testUploadThemeZipWithoutInfoFile ( ) : void
Результат void
    public function testUploadThemeZipWithoutInfoFile()
    {
        // Generate zip with no info.xml
        $this->fileName = tempnam(sys_get_temp_dir(), 'Theme');
        $filePath = $this->fileName . '.zip';
        $archive = new ZipArchive();
        $archive->open($filePath, ZipArchive::CREATE);
        $archive->addEmptyDir($this->fileName);
        $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 show an error.
        self::assertEquals(200, $this->client->getResponse()->getStatusCode());
        self::assertContains('We could not find an info.xml', $this->client->getResponse()->getContent());
    }