Skip to content

Commit

Permalink
Update test to match functionality of --output
Browse files Browse the repository at this point in the history
  • Loading branch information
gudmdharalds committed Oct 30, 2023
1 parent 708a8b5 commit bf85af0
Showing 1 changed file with 46 additions and 5 deletions.
51 changes: 46 additions & 5 deletions tests/integration/ResultsOutputDumpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ final class ResultsOutputDumpTest extends TestCase {
*/
protected function setUp() :void {
require_once __DIR__ . '/../../results.php';
require_once __DIR__ . '/../../log.php';

$this->temp_dump_file = tempnam(
sys_get_temp_dir(),
Expand Down Expand Up @@ -63,11 +64,32 @@ public function testDumpResults(): void {
'repo-name' => 'test-repo',
'commit' => 'abc123',
'prs_implicated' => array(
1 => array(
'test1',
1 => (object) array(
'title' => 'testing #1',
'base' => (object) array(
'ref' => 'main',
),
'head' => (object) array(
'ref' => 'add/testing1',
),
'user' => (object) array(
'login' => 'user1',
),
),
2 => array(
'test2',
2 => (object) array(
'title' => 'testing #2',
'base' => (object) array(
'ref' => 'main',
),
'head' => (object) array(
'ref' => 'add/testing2',
),
'user' => (object) array(
'login' => 'user2',
),
),
3 => (object) array(
'invalid' => false,
),
),
);
Expand All @@ -87,7 +109,26 @@ public function testDumpResults(): void {
);

$this->assertSame(
$data,
array(
'results' => array( 1, 2, 3, 4 ),
'repo-owner' => 'test-owner',
'repo-name' => 'test-repo',
'commit' => 'abc123',
'prs_implicated' => array(
1 => array(
'title' => 'testing #1',
'base_branch' => 'main',
'head_branch' => 'add/testing1',
'creator' => 'user1',
),
2 => array(
'title' => 'testing #2',
'base_branch' => 'main',
'head_branch' => 'add/testing2',
'creator' => 'user2',
),
),
),
$dumped_contents
);
}
Expand Down

0 comments on commit bf85af0

Please sign in to comment.