Exemplo n.º 1
0
 public function test_poster_image_upload()
 {
     $this->resetAfterTest();
     $beforeupload = local::site_coverimage_original();
     $this->assertFalse($beforeupload);
     $fixtures = ['bpd_bikes_3888px.jpg' => true, 'bpd_bikes_1381px.jpg' => true, 'bpd_bikes_1380px.jpg' => false, 'bpd_bikes_1379px.jpg' => false, 'bpd_bikes_1280px.jpg' => false, 'testpng.png' => false, 'testpng_small.png' => false, 'testgif.gif' => false, 'testgif_small.gif' => false];
     foreach ($fixtures as $filename => $shouldberesized) {
         $this->fake_site_image_setting_upload($filename);
         $css = '[[setting:poster]]';
         $css = local::site_coverimage_css($css);
         $this->assertContains('/theme_snap/coverimage/', $css);
         $ext = pathinfo($filename, PATHINFO_EXTENSION);
         $this->assertContains("/site-image.{$ext}", $css);
         if ($shouldberesized) {
             $image = local::site_coverimage();
             $finfo = $image->get_imageinfo();
             $this->assertSame(1280, $finfo['width']);
         }
     }
     $this->fake_site_image_setting_cleared();
     $css = '[[setting:poster]]';
     $css = local::site_coverimage_css($css);
     $this->assertSame('', $css);
     $this->assertFalse(local::site_coverimage());
 }