12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace Nesk\Puphpeteer\Tests;
- use Nesk\Puphpeteer\Puppeteer;
- use Nesk\Rialto\Data\JsFunction;
- use PHPUnit\Framework\ExpectationFailedException;
- use Nesk\Puphpeteer\Resources\ElementHandle;
- class DownloadTest extends TestCase
- {
- public function setUp(): void
- {
- parent::setUp();
-
- $this->serveResources();
-
- $this->launchBrowser();
- }
-
- public function download_image()
- {
-
- $page = $this->browser
- ->newPage()
- ->goto($this->url . '/puphpeteer-logo.png');
- $base64 = $page->buffer()->toString('base64');
- $imageString = base64_decode($base64);
-
- $reference = file_get_contents('tests/resources/puphpeteer-logo.png');
- $this->assertTrue(
- mb_strlen($reference) === mb_strlen($imageString),
- 'Image is not the same length after download.'
- );
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
|