PHP code example of marvinrabe / laravel-graphql-test

1. Go to this page and download the library: Download marvinrabe/laravel-graphql-test library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

marvinrabe / laravel-graphql-test example snippets




namespace Tests;

abstract class TestCase extends BaseTestCase
{
    use MarvinRabe\LaravelGraphQLTest\TestGraphQL;

    // ...
}

public $graphQLEndpoint = 'graphql';

$this->query('account', ['id' => 123], ['id']);

$this->query('account', ['id' => 123], ['id'])
  ->assertSuccessful()
  ->assertJsonFragment([
    'id' => 123
  ]);

$this->query('account', ['id' => 123], ['transactions' => ['id']]);

$this->query('accounts', ['id']);

$this->query('accounts')->getGql();

$this->mutation('accounts')->getGql();
$this->mutation('accounts', ['id']);
$this->mutation('accounts', ['id' => 123]); 

$this->query('accounts', ['status' => $this->enum('closed')], ['id']);

$this->query('accounts', ['status' => new \MarvinRabe\LaravelGraphQLTest\Scalars\EnumType('closed')], ['id']);

class AccountsTest extends TestCase
{
    protected $defaultHeaders = [
        "Authorization" => "Bearer TOKEN",
    ];
    
    // ...
}