liip / LiipTestFixturesBundle

This bundles enables efficient loading of Doctrine fixtures in functional test-cases for Symfony applications
https://liip.ch
MIT License
166 stars 45 forks source link

PHP Fatal error: Uncaught Error: Class 'Liip\TestFixturesBundle\LiipTestFixturesBundle' not found #28

Closed lukepass closed 5 years ago

lukepass commented 5 years ago

Hello, when installing vendors in the production environment i get this error:

[RuntimeException]                                                                                                                               

    An error occurred when executing the "'cache:clear --no-warmup'" command:                                                                      

    PHP Fatal error:  Uncaught Error: Class 'Liip\TestFixturesBundle\LiipTestFixturesBundle' not found

Preconditions

This is my composer.json file:

{
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-4": {
            "AppBundle\\": "src/AppBundle"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        },
        "files": [
            "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
        ]
    },
    "require": {
        "php": ">=5.5.9",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/doctrine-fixtures-bundle": "^3.0",
        "doctrine/orm": "^2.5",
        "friendsofsymfony/rest-bundle": "^2.3",
        "greenskies/web-log-viewer-bundle": "^0.0.8",
        "incenteev/composer-parameter-handler": "^2.0",
        "jms/serializer-bundle": "^2.4",
        "kunicmarko/sonata-annotation-bundle": "^1.1",
        "nelmio/api-doc-bundle": "^3.4",
        "php-translation/symfony-bundle": "^0.8.1",
        "sensio/distribution-bundle": "^5.0.19",
        "sensio/framework-extra-bundle": "^5.0.0",
        "sonata-project/admin-bundle": "^3.35",
        "sonata-project/doctrine-orm-admin-bundle": "^3.6",
        "sonata-project/easy-extends-bundle": "^2.5",
        "sonata-project/media-bundle": "^3.13",
        "sonata-project/user-bundle": "^4.1",
        "stof/doctrine-extensions-bundle": "^1.3",
        "symfony/monolog-bundle": "^3.1.0",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/swiftmailer-bundle": "^2.6.4",
        "symfony/symfony": "3.4.*",
        "twig/twig": "^1.0||^2.0"
    },
    "require-dev": {
        "johnkary/phpunit-speedtrap": "^3.1",
        "joshtronic/php-loremipsum": "^1.0",
        "liip/functional-test-bundle": "^3.0.0",
        "liip/test-fixtures-bundle": "^1.0.0",
        "phpstan/phpstan": "^0.9.2",
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^4.1"
    },
    "scripts": {
        "symfony-scripts": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-install-cmd": [
            "@symfony-scripts"
        ],
        "post-update-cmd": [
            "@symfony-scripts"
        ]
    },
    "config": {
        "sort-packages": true
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": null
    }
}

And this is my AppKernel file:

<?php

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),

            // Sonata dependencies
            new Sonata\CoreBundle\SonataCoreBundle(),
            new Sonata\BlockBundle\SonataBlockBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
            new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
            new Sonata\Doctrine\Bridge\Symfony\Bundle\SonataDoctrineBundle(),

            // SonataAdminBundle
            new Sonata\AdminBundle\SonataAdminBundle(),

            // SonataUserBundle
            new FOS\UserBundle\FOSUserBundle(),
            new Sonata\UserBundle\SonataUserBundle(),

            // StofDoctrineExtensionsBundle
            new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),

            // FOSRestBundle
            new FOS\RestBundle\FOSRestBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle(),

            // SonataMediaBundle
            new Sonata\MediaBundle\SonataMediaBundle(),

            // TranslationBundle
            new Translation\Bundle\TranslationBundle(),

            // WebLogViewerBundle
            new Greenskies\WebLogViewerBundle\WebLogViewerBundle(),

            // SonataAnnotationBundle
            new KunicMarko\SonataAnnotationBundle\SonataAnnotationBundle(),

            // NelmioApiDocBundle
            new Nelmio\ApiDocBundle\NelmioApiDocBundle(),

            // DoctrineFixturesBundle
            new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),

            // LiipTestFixturesBundle
            new Liip\TestFixturesBundle\LiipTestFixturesBundle(),

            // this should always be the last bundle
            new AppBundle\AppBundle(),
        ];

        if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();

            if ('dev' === $this->getEnvironment()) {
                $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
                $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
            }

            if ('test' === $this->getEnvironment()) {
                $bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();
            }
        }

        return $bundles;
    }

    public function getRootDir()
    {
        return __DIR__;
    }

    public function getCacheDir()
    {
        return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
    }

    public function getLogDir()
    {
        return dirname(__DIR__).'/var/logs';
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load(function (ContainerBuilder $container) {
            $container->setParameter('container.autowiring.strict_mode', true);
            $container->setParameter('container.dumper.inline_class_loader', true);

            $container->addObjectResource($this);
        });
        $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
    }
}

I am using Symfony 3.4 with PHP 7.2.

Thanks!

lukepass commented 5 years ago

I forgot the command:

export SYMFONY_ENV='prod'; composer install --verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader
lukepass commented 5 years ago

Sorry, you can close it! I added the bundle outside of the test section :) Partially related to this: https://github.com/doctrine/DoctrineFixturesBundle/issues/225