public function testMutatesTheDataSet() { $mutation = 'mutation AddBWingQuery($input: IntroduceShipInput!) { introduceShip(input: $input) { ship { id name } faction { name } clientMutationId } }'; $params = array('input' => array('shipName' => 'B-Wing', 'factionId' => '1', 'clientMutationId' => 'abcde')); $expected = array('introduceShip' => array('ship' => array('id' => 'U2hpcDo5', 'name' => 'B-Wing'), 'faction' => array('name' => 'Alliance to Restore the Republic'), 'clientMutationId' => 'abcde')); $result = GraphQL::execute(StarWarsSchema::getSchema(), $mutation, null, null, $params); $this->assertEquals(['data' => $expected], $result); }
/** * Helper function to test a query and the expected response. */ private function assertValidQuery($query, $expected) { $result = GraphQL::execute(StarWarsSchema::getSchema(), $query); $this->assertEquals(['data' => $expected], $result); }