GithubHelp home page GithubHelp logo

Comments (9)

mcg-web avatar mcg-web commented on May 28, 2024

Can you try to run your tests in isolated process please (like phpunit)?

from graphqlbundle.

VincentClair avatar VincentClair commented on May 28, 2024

Thanks for your reply. I ran only the crashed test and here is the result:

Api Tests (3) -------------------------------------------------------------------------------------------------
Modules: Symfony2, Doctrine2, REST, \Helper\Api
---------------------------------------------------------------------------------------------------------------
Get all manufacturers (Loyalty\ProductBundle\Tests\GraphQL\GraphQLCest::getManufacturers)
Scenario:
* I send post "/auth/login",{"_username":"admin","_password":"admin"}

  [Request headers] []
  [Request] POST /auth/login {"_username":"admin","_password":"admin"}
  [Response] 
  [Headers] {"cache-control":["no-cache"],"x-debug-token":["0d95df"],"Set-Cookie":[{},{}]}
  [Status] 204
* I see response code is 204
* I send get "/",{"query":"query Manufacturers {
    manufacturers {
        id,
        name
    }
}"}
  [Request headers] []
  [Request] GET /?query=query+Manufacturers+%7B%0A++++manufacturers+%7B%0A++++++++id%2C%0A++++++++name%0A++++%7D%0A%7D
PHP Fatal error:  Class 'Overblog\GraphQLBundle\__DEFINITIONS__\RangeFilterType' not found in /var/www/loyalty/product-bundle/var/cache/appTestDebugProjectContainer.php on line 3662

Fatal error: Class 'Overblog\GraphQLBundle\__DEFINITIONS__\RangeFilterType' not found in /var/www/loyalty/product-bundle/var/cache/appTestDebugProjectContainer.php on line 3662

RangeFilter seems the only one input-object that crash. It is not used by the query, as i try to get manufacturers, but not products.

Here my full query definition:

Query:
    type: object
    config:
        description: "Product bundle."
        fields:
            getProducts:
                type: "QueryProduct"
                args:
                    filter:
                        description: "Product search filters."
                        type: "ProductFilter"
                    page:
                        description: "Pagination number."
                        type: "Int"
                    limit:
                        description: "Pagination limit."
                        type: "Int"
                resolve: "@=service('loyalty_product.product_manager').find(user, args['page'], args['limit'], args['filter'])"
            manufacturers:
                type: "[Manufacturer]"
                resolve: "@=service('loyalty_product.manufacturer_manager').find()"

from graphqlbundle.

mcg-web avatar mcg-web commented on May 28, 2024

What's the content of your test cache dir please? it should look like that: my/path/to/cache/overblog/graph-bundle/__definitions__

from graphqlbundle.

VincentClair avatar VincentClair commented on May 28, 2024

The content of /var/cache/overblog/graph-bundle/__definitions__:

__types.bootstrap.php.cache
ManufacturerType.php
PageInfoType.php
ProductFilterType.php
ProductHighLightFilterType.php
ProductLangFilterType.php
ProductOrderFieldFilterType.php
ProductOrderFilterType.php
ProductOrderTypeFilterType.php
ProductSearchFilterType.php
ProductType.php
QueryProductType.php
QueryType.php
RangeFilterType.php

And the source of RangeFilterType.php:

namespace Overblog\GraphQLBundle\__DEFINITIONS__;

use GraphQL\Type\Definition\InputObjectType;
use GraphQL\Type\Definition\Type;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

/**
 * THIS FIELD WAS GENERATED AND SHOULD NOT BE MODIFIED!
 */
final class RangeFilterType extends InputObjectType
{
    public function __construct(ContainerInterface $container)
    {
        $request = null;
        $token = null;
        $user = null;
        if ($container->has('request_stack')) {
            $request = $container->get('request_stack')->getCurrentRequest();
        }
        if ($container->has('security.token_storage')) {
            $token = $container->get('security.token_storage')->getToken();
            if ($token instanceof TokenInterface) {
                $user = $token->getUser();
            }
        }

        parent::__construct([
            'name' => 'RangeFilter',
            'description' => 'Range filter',
            'fields' => [
                'min' => [
                    'type' => function () use ($container, $request, $user, $token) { return Type::float(); },
                    'defaultValue' => null,
                    'description' => 'Min value.',
                ],
                'max' => [
                    'type' => function () use ($container, $request, $user, $token) { return Type::float(); },
                    'defaultValue' => null,
                    'description' => 'Max value.',
                ],
            ],
        ]);
    }

    public static function getName()
    {
        $class = substr(strrchr(__CLASS__, "\\"), 1);
        return substr($class, 0, -4);
    }
}

from graphqlbundle.

mcg-web avatar mcg-web commented on May 28, 2024

And the content of __types.bootstrap.php.cache? if it not empty try to require it before you test please

from graphqlbundle.

VincentClair avatar VincentClair commented on May 28, 2024

It seems that the file __types.bootstrap.php.cache is not always generated. When i re initialize the app, sometimes, it is not there or empty.

from graphqlbundle.

mcg-web avatar mcg-web commented on May 28, 2024

I'm going to work on a fix! You can switch to the last release v0.3.0 this should fix the problem for the moment.

from graphqlbundle.

VincentClair avatar VincentClair commented on May 28, 2024

It works with 0.3 (because there is no cache, i presume).

(Just a notice: could you add a documentation on 'inline-object' too ? Thanks :)

from graphqlbundle.

mcg-web avatar mcg-web commented on May 28, 2024

Feel free to reopen if the fix doesn't solve your issue. I added the input-object documentation.

from graphqlbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.