3 namespace Zumba\GastonJS\Tests;
6 * Class BrowserRenderTest
7 * @package Zumba\GastonJS\Tests
9 class BrowserRenderTest extends BrowserCommandsTestCase {
11 public function testRenderBase64() {
12 $this->visitUrl($this->getTestPageBaseUrl() . "/static/basic.html");
13 //Check we get a string
14 $stringData = $this->browser->renderBase64("png");
15 $this->assertTrue(is_string($stringData));
16 $binaryData = base64_decode($stringData, true);
17 //now we check that the binary data is actually PNG
18 $fileInfo = new \finfo(FILEINFO_MIME);
19 $this->assertNotFalse($binaryData);
20 $this->assertNotFalse(strstr($fileInfo->buffer($binaryData), "image/png"));
23 public function testRenderFile() {
24 $this->visitUrl($this->getTestPageBaseUrl() . "/static/basic.html");
25 $tempFile = sprintf("%s/%d.png", sys_get_temp_dir(), time());
26 $this->assertTrue($this->browser->render($tempFile));
27 $this->assertFileExists($tempFile);
30 //TODO: Test properly the selection stuff and the paper size