Pull merge.
[yaffs-website] / vendor / jcalderonzumba / gastonjs / tests / unit / BrowserRenderTest.php
1 <?php
2
3 namespace Zumba\GastonJS\Tests;
4
5 /**
6  * Class BrowserRenderTest
7  * @package Zumba\GastonJS\Tests
8  */
9 class BrowserRenderTest extends BrowserCommandsTestCase {
10
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"));
21   }
22
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);
28   }
29
30   //TODO: Test properly the selection stuff and the paper size
31
32
33 }