Example #1
0
 /**
  * Test if we can upload a theme with a zip that contains only the files (not wrapped in a parent folder).
  *
  * @return void
  */
 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());
 }
 /**
  * @param \Symfony\Component\DomCrawler\Crawler $crawler
  * @param \Symfony\Bundle\FrameworkBundle\Client $client
  *
  * @return mixed
  */
 private function runTroughStep5($crawler, $client)
 {
     $form = $crawler->selectButton('Finish installation')->form();
     $client->submit($form, array('install_login[email]' => '*****@*****.**', 'install_login[password][first]' => 'password', 'install_login[password][second]' => 'password'));
     $crawler = $client->followRedirect();
     // we should be redirected to step 6
     self::assertEquals(200, $client->getResponse()->getStatusCode());
     self::assertStringEndsWith('/install/6', $client->getHistory()->current()->getUri());
     self::assertGreaterThan(0, $crawler->filter('h2:contains("Installation complete")')->count());
     return $crawler;
 }
Example #3
0
 /**
  * @param Client $client
  */
 protected function assertIs404($client)
 {
     $client->followRedirect();
     $this->assertEquals(404, $client->getResponse()->getStatusCode());
     $this->assertStringEndsWith('404', $client->getHistory()->current()->getUri());
 }
Example #4
0
 protected function assertCurrentRoute($route, $param = [])
 {
     $this->assertEquals($this->generateUrl($route, $param), $this->client->getHistory()->current()->getUri());
 }
 /**
  * Returns the History instance.
  *
  * @return History A History instance
  *
  * @api
  */
 public function getHistory()
 {
     return $this->subject->getHistory();
 }