Fixtures installation error in sylius? - symfony

I want to install fixtures in sylius i used below command to install it that are as below
php app/console sylius:install --fixtures
when i ran above command i get error as
>PHP Fatal error: Class 'ResourceBundle' not found in C:\wamp\www\sylius\sylius\vendor\symfony\symfony\src\Symfony\Component\Locale\Locale.php on line 51
PHP Stack trace:
PHP 1. {main}() C:\wamp\www\sylius\sylius\app\console:0
PHP 2. Symfony\Component\Console\Application->run() C:\wamp\www\sylius\sylius\app\console:28
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\wamp\www\sylius\sylius\vendor\symfon
y\symfony\src\Symfony\Component\Console\Application.php:106
PHP 4. Symfony\Component\Console\Application->doRun() C:\wamp\www\sylius\sylius\vendor\symfony\symfony\src
\Symfony\Bundle\FrameworkBundle\Console\Application.php:78
PHP 5. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\sylius\vendor\symfony\symfony\s
rc\Symfony\Component\Console\Application.php:193
PHP 6. Sylius\Bundle\CoreBundle\Command\InstallCommand->execute() C:\wamp\www\sylius\sylius\vendor\symfony
\symfony\src\Symfony\Component\Console\Command\Command.php:242
PHP 7. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\sylius\src\Sylius\Bundle\CoreBu
ndle\Command\InstallCommand.php:80
PHP 8. Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand->execute() C:\wamp\www\syliu
s\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:242
PHP 9. Doctrine\Common\DataFixtures\Executor\ORMExecutor->execute() C:\wamp\www\sylius\sylius\vendor\doctr
ine\doctrine-fixtures-bundle\Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand.php:106
PHP 10. Doctrine\ORM\EntityManager->transactional() C:\wamp\www\sylius\sylius\vendor\doctrine\data-fixtures
\lib\Doctrine\Common\DataFixtures\Executor\ORMExecutor.php:85
PHP 11. call_user_func() C:\wamp\www\sylius\sylius\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php:2
23
PHP 12. Doctrine\Common\DataFixtures\Executor\ORMExecutor->Doctrine\Common\DataFixtures\Executor\{closure}(
) C:\wamp\www\sylius\sylius\vendor\doctrine\orm\lib\Doctrine\ORM\EntityManager.php:223
PHP 13. Doctrine\Common\DataFixtures\Executor\AbstractExecutor->load() C:\wamp\www\sylius\sylius\vendor\doc
trine\data-fixtures\lib\Doctrine\Common\DataFixtures\Executor\ORMExecutor.php:83
PHP 14. Sylius\Bundle\CoreBundle\DataFixtures\ORM\LoadCountriesData->load() C:\wamp\www\sylius\sylius\vendo
r\doctrine\data-fixtures\lib\Doctrine\Common\DataFixtures\Executor\AbstractExecutor.php:120
PHP 15. Symfony\Component\Locale\Locale::getDisplayCountries() C:\wamp\www\sylius\sylius\src\Sylius\Bundle\
CoreBundle\DataFixtures\ORM\LoadCountriesData.php:31
I try to install resource bundle when i got the above error but it also failed to install.
Is there any other way is avilable to install fixtures in sylius?
Please share some knowledge..Thanks in advance.

You need to have intl installed on your environment. Symfony does not provide a stub class for "en" locale.

Related

How can we run the unit tests of civicrm from script?

I execute this commande line to run a unit tests :
hatem.hadrich#pc_Hatem_Hadrich:/projet/tools$ php /scripts/phpunit CRM_AllTests
I have this error when i run a unit test from my local instance and i can not find a way to resolve it anyone can help me to fix this bug.
PHP Fatal error: Class 'CiviTestSuite' not found in /projet/../civicrm/tests/phpunit/CRM/AllTests.php on line 39
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:569
PHP 3. PHPUnit_TextUI_Command->run()
phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:115
PHP 4. PHPUnit_Runner_BaseTestRunner->getTest()
phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:137
PHP 5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass()
phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php:65
PHP 6. PHPUnit_Runner_StandardTestSuiteLoader->load()
phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php:124
PHP 7. PHPUnit_Util_Fileloader::checkAndLoad() phar:///usr/local/bin/phpunit/phpunit/Runner/StandardTestSuiteLoader.php:39
PHP 8. PHPUnit_Util_Fileloader::load() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:38
PHP 9. include_once() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:56
i have find a way to fix this bug, you must require_one for the bootstrap file inside CiviTest :
define('DRUPAL_ROOT', '/path_to_project');
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';

PHP Fatal error returned when creating a new Symfony3 Project [duplicate]

Am new to symfony and from last month am continuously installing new symfony project using following command on ubuntu from the terminal
# Linux, Mac OS X
$ symfony new my_project_name
and it was working perfectly until today, but than just checked the new version release, but now it started giving me following error
Downloading Symfony...
4.93 MB/4.93 MB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100%
Preparing project...
PHP Warning: require(/var/www/projectname/app/SymfonyRequirements.php): failed to open stream: No such file or directory in phar:///usr/local/bin/symfony/src/Symfony/Installer/DownloadCommand.php on line 265
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/symfony:0
PHP 2. require() /usr/local/bin/symfony:10
PHP 3. Symfony\Component\Console\Application->run() phar:///usr/local/bin/symfony/symfony:35
PHP 4. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:195
PHP 6. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:878
PHP 7. Symfony\Installer\NewCommand->execute() phar:///usr/local/bin/symfony/vendor/symfony/console/Command/Command.php:259
PHP 8. Symfony\Installer\DownloadCommand->checkSymfonyRequirements() phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php:65
PHP Fatal error: require(): Failed opening required '/var/www/projectname/app/SymfonyRequirements.php' (include_path='.:/usr/share/php:/usr/share/pear') in phar:///usr/local/bin/symfony/src/Symfony/Installer/DownloadCommand.php on line 265
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/symfony:0
PHP 2. require() /usr/local/bin/symfony:10
PHP 3. Symfony\Component\Console\Application->run() phar:///usr/local/bin/symfony/symfony:35
PHP 4. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:126
PHP 5. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:195
PHP 6. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/symfony/vendor/symfony/console/Application.php:878
PHP 7. Symfony\Installer\NewCommand->execute() phar:///usr/local/bin/symfony/vendor/symfony/console/Command/Command.php:259
PHP 8. Symfony\Installer\DownloadCommand->checkSymfonyRequirements() phar:///usr/local/bin/symfony/src/Symfony/Installer/NewCommand.php:65
I have even check the symfony at location usr/local/bin/symfony and it was there.
It is a resolved issue that you need to specify the version you want to install. As described here and here, you need to:
Update your installer
>symfony self-update
or with sudo, depending on how you install it:
>sudo symfony self-update
Specify the version:
>symfony new my_project_name 3.0
Hope this helps.
UPDATE
With the correct resolutions of the bug on the Symfony installer, now the 3.0 is the default version. In other case, you can specify the complete version (with minor and major) as follows:
>symfony new my_project_name 3.0.0

Unable to run phpunit since upgrade to Symfony 2.8/3.0

Since upgrading to Symfony 2.8, I get the following error when I run phpunit in the Symfony root:
PHP Fatal error: Class 'PHPUnit_Util_ErrorHandler' not found in /var/www/foo/symfony/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php on line 40
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:129
PHP 4. PHPUnit_TextUI_Command->handleArguments() /usr/share/php/PHPUnit/TextUI/Command.php:138
PHP 5. PHPUnit_Util_Configuration->getTestSuiteConfiguration() /usr/share/php/PHPUnit/TextUI/Command.php:657
PHP 6. PHPUnit_Util_Configuration->getTestSuite() /usr/share/php/PHPUnit/Util/Configuration.php:789
PHP 7. PHPUnit_Framework_TestSuite->addTestFiles() /usr/share/php/PHPUnit/Util/Configuration.php:873
PHP 8. PHPUnit_Framework_TestSuite->addTestFile() /usr/share/php/PHPUnit/Framework/TestSuite.php:416
PHP 9. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/php/PHPUnit/Framework/TestSuite.php:355
PHP 10. PHPUnit_Util_Fileloader::load() /usr/share/php/PHPUnit/Util/Fileloader.php:76
PHP 11. Symfony\Bridge\PhpUnit\DeprecationErrorHandler::Symfony\Bridge\PhpUnit\{closure}() /usr/share/php/PHPUnit/Util/Fileloader.php:92
THE ERROR HANDLER HAS CHANGED!
This also occurs under Symfony 3.0. Should I now be running phpunit in a different manner?
I just ran into this problem using Symfony 2.8.
Just update your local install of phpunit.
Run this.
phpunit --self-update
That should do it.
I was running phpunit version 4.7.*, but Symfony wanted to see phpunit 5.1.3.
You should clear the app/cache/test directory.
You could also make your global phpunit symlink to the one provided by Symfony located in vendor/phpunit/phpunit/phpunit
Update: I'm not sure what this error is referring to, I still get it, but seems to occur when I have a problem with a test. At the least, it's a confusing message.

PHPUnit throws error on mountain lion

I've followed the instructions exactly described as here
http://phpunit.de/getting-started.html
Everything went fine but when i execute the following command
phpunit --bootstrap src/autoload.php tests/MoneyTest
It throws following error
PHPUnit 4.0.4 by Sebastian Bergmann.
PHP Fatal error: Class 'SebastianBergmann\Money\Money' not found in /Users/myname/Sites/lab/unittesting/tests/MoneyTest.php on line 54
PHP Stack trace:
PHP 1. {main}() /usr/local/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:581
PHP 3. PHPUnit_TextUI_Command->run() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:132
PHP 4. PHPUnit_TextUI_TestRunner->doRun() phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:179
PHP 5. PHPUnit_Framework_TestSuite->run() phar:///usr/local/bin/phpunit/phpunit/TextUI/TestRunner.php:419
PHP 6. PHPUnit_Framework_TestCase->run() phar:///usr/local/bin/phpunit/phpunit/Framework/TestSuite.php:722
PHP 7. PHPUnit_Framework_TestResult->run() phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:764
PHP 8. PHPUnit_Framework_TestCase->runBare() phar:///usr/local/bin/phpunit/phpunit/Framework/TestResult.php:692
PHP 9. PHPUnit_Framework_TestCase->runTest() phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:824
PHP 10. ReflectionMethod->invokeArgs() phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:956
PHP 11. SebastianBergmann\Money\MoneyTest->testExceptionIsRaisedForInvalidConstructorArguments() phar:///usr/local/bin/phpunit/phpunit/Framework/TestCase.php:956
Any idea what might be the cause?
Thanks
The following instructions worked for me:
$ git clone https://github.com/sebastianbergmann/money
$ cd money
$ phpunit --bootstrap src/autoload.php tests/MoneyTest
PHPUnit 3.7.32 by Sebastian Bergmann.
......................
Time: 882 ms, Memory: 3.25Mb
OK (22 tests, 41 assertions)
Be aware that I using 3.7.32 and you are using 4.0.4. If its still not working then it could be a bug.

Sylius cache management

When I started to use Sylius I did not realize that it is not stable yet and I fully customized the dev version instead of starting a new project. Now, I think that I can't put it in prod because of cache management :
Images do not always load but sometimes :
Resource interpreted as Image but transferred with MIME type text/html
Same for CSS and JS :
net::ERR_CONNECTION_RESET
And I can't clear the cache with php app/console cache:clear -e prod :
Clearing the cache for the prod environment with debug true
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 98304 bytes) in C:\wamp\www\sylius\app\cache\pro_\twig\9a\2e\9cb2d88c764cb674efaa179d7259f64ff3b6396785924a758ca5728914b5.php on line 98
PHP Stack trace:
PHP 1. {main}() C:\wamp\www\sylius\app\console:0
PHP 2. Symfony\Component\Console\Application->run() C:\wamp\www\sylius\app\console:28
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:121
PHP 4. Symfony\Component\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:96
PHP 5. Symfony\Component\Console\Application->doRunCommand() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:191
PHP 6. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:905
PHP 7. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:244
PHP 8. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:83
PHP 9. Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:120
PHP 10. Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php:47
PHP 11. Twig_Environment->loadTemplate() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer.php:62
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 98304 bytes) in C:\wamp\www\sylius\app\cache\pro_\twig\9a\2e\9cb2d88c764cb674efaa179d7259f64ff3b6396785924a758ca5728914b5.php on line 98
Call Stack:
0.0005 331032 1. {main}() C:\wamp\www\sylius\app\console:0
0.0698 3608112 2. Symfony\Component\Console\Application->run() C:\wamp\www\sylius\app\console:28
0.0764 3860448 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:121
0.6014 15730344 4. Symfony\Component\Console\Application->doRun() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:96
0.6027 15730344 5. Symfony\Component\Console\Application->doRunCommand() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:191
0.6034 15755448 6. Symfony\Component\Console\Command\Command->run() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:905
0.6037 15755792 7. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command.php:244
0.7519 16165176 8. Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:83
7.0263 57502064 9. Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand.php:120
14.6093 95010368 10. Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer->warmUp() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate.php:47
21.6284 133900880 11. Twig_Environment->loadTemplate() C:\wamp\www\sylius\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\CacheWarmer\TemplateCacheCacheWarmer.php:62
EDIT : I already cleared the cache manually but it didn't change anything.
Try this:
#!/user/local/bin/php app/console cache:clear --env=prod
The answer is based on symfony documention:
https://symfony.com/doc/2.8/console/usage.html

Resources