Skip to content

Commit

Permalink
added new tests for multiple inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
Emre Sokullu committed Jun 9, 2017
1 parent 7d2e89f commit 09f9676
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.2
2.0.3
34 changes: 34 additions & 0 deletions tests/SchemaWithMultipleInheritanceTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/*
* This file is part of the Pho package.
*
* (c) Emre Sokullu <emre@phonetworks.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Pho\Lib\GraphQL\Parser;


class SchemaWithMultipleInheritanceTest extends \PHPUnit\Framework\TestCase {

private $parsed;

public function setUp() {
$this->parsed = new Parse(__DIR__."/assets/SchemaWithMultipleInheritance.graphql");
}

public function tearDown() {
unset($this->parsed);
}

public function testMultipleInheritance() {
$this->assertEquals("Something", $this->parsed->entity(0)->implementation(0)->name());
$this->assertEquals("SomethingElse", $this->parsed->entity(0)->implementation(1)->name());
$this->assertEquals("SomethingNoComma", $this->parsed->entity(1)->implementation(0)->name());
$this->assertEquals("SomethingElseNoComma", $this->parsed->entity(1)->implementation(1)->name());
}

}
9 changes: 9 additions & 0 deletions tests/assets/SchemaWithMultipleInheritance.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type Basic implements Something, SomethingElse {
id: ID!,
context: String!
user: User
}

type BasicNoComma implements SomethingNoComma SomethingElseNoComma {
id: ID,
}
4 changes: 2 additions & 2 deletions tests/assets/SnapSchema.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- invalid -->
<!-- because of no field -->
# <!-- invalid -->
# <!-- because of no field -->

type Snap @is_a(type: "Object") @extends(type: "Content") {
@expirable(in: 60*60*24)
Expand Down

0 comments on commit 09f9676

Please sign in to comment.