Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
Use assertSame() instead of assertEquals()
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Stenvall committed Nov 8, 2018
1 parent 121cddb commit 9f64238
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/Unit/Execution/ExecutionResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,35 @@ public function testBasics(): void

$this->assertNull($executionResult->getData());
$this->assertEmpty($executionResult->getErrors());
$this->assertEquals(['data' => null], $executionResult->toArray());
$this->assertSame(['data' => null], $executionResult->toArray());

// Start with data and no errors
$executionResult = new ExecutionResult(['foo' => 'bar'], []);

$this->assertEquals(['foo' => 'bar'], $executionResult->getData());
$this->assertEmpty($executionResult->getErrors());
$this->assertEquals(['data' => ['foo' => 'bar']], $executionResult->toArray());
$this->assertSame(['data' => ['foo' => 'bar']], $executionResult->toArray());

// Start with data and an error
$executionResult = new ExecutionResult(['foo' => 'bar'], [new GraphQLException('Error')]);

$this->assertEquals(['foo' => 'bar'], $executionResult->getData());
$this->assertCount(1, $executionResult->getErrors());
$this->assertEquals([
'data' => ['foo' => 'bar'],
$this->assertSame([
'errors' => [
[
'message' => 'Error',
'locations' => null,
'path' => null
]
]
],
'data' => ['foo' => 'bar'],
], $executionResult->toArray());

// Add another error
$executionResult->addError(new GraphQLException('Another error'));
$this->assertCount(2, $executionResult->getErrors());
$this->assertEquals([
'data' => ['foo' => 'bar'],
$this->assertSame([
'errors' => [
[
'message' => 'Error',
Expand All @@ -57,7 +56,8 @@ public function testBasics(): void
'locations' => null,
'path' => null
]
]
],
'data' => ['foo' => 'bar'],
], $executionResult->toArray());
}
}

0 comments on commit 9f64238

Please sign in to comment.