-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from silinternational/develop
Release 2.9.0: Add batching simulation to mock
- Loading branch information
Showing
8 changed files
with
178 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace SilMock\Google\Http; | ||
|
||
class Batch | ||
{ | ||
public array $batch = []; | ||
|
||
public function add($result, string $key) | ||
{ | ||
$this->batch[$key] = $result; | ||
} | ||
|
||
public function execute() | ||
{ | ||
return $this->batch; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Http; | ||
|
||
use PHPUnit\Framework\Assert; | ||
use PHPUnit\Framework\TestCase; | ||
use SilMock\Google\Http\Batch; | ||
|
||
class BatchTest extends TestCase | ||
{ | ||
public string $dataFile = DATAFILE5; | ||
public const GROUP_EMAIL_ADDRESS = '[email protected]'; | ||
|
||
public function testAddAndExecute() | ||
{ | ||
$batch = new Batch(); | ||
$batch->add('RESULT', 'key'); | ||
$results = $batch->execute(); | ||
$expected = [ | ||
'key' => 'RESULT', | ||
]; | ||
Assert::assertEquals($expected, $results); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.