Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

A simple example module for graphQl queries and mutations

License

Notifications You must be signed in to change notification settings

OXID-eSales/graphql-example-module

Repository files navigation

oxid-esales/graphql-example

Status Build Status PHP Version Stable Version

This module is abandoned. Please look at oxid-esales/graphql-catalogue for good examples instead.


This module provides a basic example on how to extend the oxid-esales/graphql-base module.

Usage

This assumes you have the OXID eShop up and running and installed and activated the oxid-esales/graphql-base module.

DO NOT USE IN PRODUCTION, THIS MODULE IS FOR DEMO PURPOSES ONLY

Install

$ composer require oxid-esales/graphql-example

After requiring the module, you need to head over to the OXID eShop admin and activate the GraphQL Example module.

How to use

  1. Install oxid-esales/graphql-base module
  2. Get token (see base module documentation)
  3. Execute example query to get all categories

Request query

query {
  categories {
    id
    name
  }
}

Response example

{
    "data": {
        "categories": [
            {
                "id": "30e44ab83fdee7564.23264141",
                "name": "Bekleidung"
            },
            {
                "id": "943173edecf6d6870a0f357b8ac84d32",
                "name": "Wakeboarding"
            },
            {
                "id": "943a9ba3050e78b443c16e043ae60ef3",
                "name": "Kiteboarding"
            },
            {
                "id": "fadcb6dd70b9f6248efa425bd159684e",
                "name": "Angebote"
            },
            {
                "id": "oia9ff5c96f1f29d527b61202ece0829",
                "name": "Downloads"
            }
        ]
    }
}

Testing

Linting, syntax, static analysis and unit tests

$ composer test

Integration tests

  • install this module into a running OXID eShop
  • change the test_config.yml
    • add oe/graphql-example to the partial_module_paths
    • set activate_all_modules to true
$ ./vendor/bin/runtests

License

GPLv3, see LICENSE file.