File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ' ,
Original file line number Diff line number Diff line change 1111
1212class 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 ();
Original file line number Diff line number Diff line change 1717
1818class 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 ();
Original file line number Diff line number Diff line change 33namespace SynergiTech \ChromePDF \Test ;
44
55use PHPUnit \Framework \TestCase as PHPUnitTestCase ;
6+ use SynergiTech \ChromePDF \Chrome ;
67
78class 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}
You can’t perform that action at this time.
0 commit comments