This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
drupalcampbristol/vendor/behat/mink/driver-testsuite/tests/Basic/ScreenshotTest.php

31 lines
807 B
PHP

<?php
namespace Behat\Mink\Tests\Driver\Basic;
use Behat\Mink\Tests\Driver\TestCase;
class ScreenshotTest extends TestCase
{
public function testScreenshot()
{
if (!extension_loaded('gd')) {
$this->markTestSkipped('Testing screenshots requires the GD extension');
}
$this->getSession()->visit($this->pathTo('/index.html'));
$screenShot = $this->getSession()->getScreenshot();
$this->assertInternalType('string', $screenShot);
$this->assertFalse(base64_decode($screenShot, true), 'The returned screenshot should not be base64-encoded');
$img = imagecreatefromstring($screenShot);
if (false === $img) {
$this->fail('The screenshot should be a valid image');
}
imagedestroy($img);
}
}