Skip to content

Commit f708e95

Browse files
committed
Make some final changes to tidy up the code
1 parent 7d993d8 commit f708e95

5 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/Browserless/Client.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ trait Client
2121
*/
2222
private $apiUrl = 'https://chrome.browserless.io';
2323

24+
public const EUROPE_REGION_URL = 'production-lon.browserless.io';
25+
26+
public const US_REGION_URL = 'production-sfo.browserless.io';
27+
2428
/**
2529
* @param string $apiKey api key from browserless.io
2630
* @param \GuzzleHttp\Client $client custom Guzzle client

src/Browserless/Screenshot.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ class Screenshot
1919
public function render(string $url, array $options = [])
2020
{
2121
$options = array_merge([
22-
'quality' => 75,
2322
'type' => 'jpeg',
2423
'fullPage' => false,
2524
], $options);
25+
if ($options['type'] === 'jpeg' && ! isset($options['quality'])) {
26+
$options['quality'] = 75;
27+
}
2628

2729
return $this->request(
2830
endpoint: '/screenshot',

test/Browserless/ScreenshotTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@
1111

1212
class ScreenshotTest extends TestCase
1313
{
14-
private function getMockedClient()
15-
{
16-
return $this->getMockBuilder(Chrome::class)
17-
->setMethods(['post'])
18-
->getMock();
19-
}
20-
2114
public function test_render()
2215
{
2316
$client = $this->getMockedClient();

test/BrowserlessTest.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717

1818
class BrowserlessTest extends TestCase
1919
{
20-
private function getMockedClient()
21-
{
22-
return $this->getMockBuilder(Chrome::class)
23-
->setMethods(['post'])
24-
->getMock();
25-
}
26-
2720
public function test_rotation()
2821
{
2922
$client = $this->getMockedClient();

test/TestCase.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@
33
namespace SynergiTech\ChromePDF\Test;
44

55
use PHPUnit\Framework\TestCase as PHPUnitTestCase;
6+
use SynergiTech\ChromePDF\Chrome;
67

78
class TestCase extends PHPUnitTestCase
89
{
910
public function hasKeyValue($key, $constraint = null)
1011
{
1112
return new Constraint\ArrayHasKeyValue($key, $constraint);
1213
}
14+
15+
protected function getMockedClient()
16+
{
17+
return $this->getMockBuilder(Chrome::class)
18+
->setMethods(['post'])
19+
->getMock();
20+
}
1321
}

0 commit comments

Comments
 (0)