Laravel - CircleCI - Fails on phpunit - php

I have started the process of making use on Continuous Integration and I have decided on circleci.
Please let me know if I can supply any other information as I am lost at this point.
When circleci tries to run the phpunit command it returns the following error:
I have failed miserably at solving this issue.
vendor/bin/phpunit
PHPUnit 3.7.37 by Sebastian Bergmann.
Configuration read from /home/ubuntu/simple/phpunit.xml
PHP Fatal error: Class 'Illuminate\View\Environment' not found in /home/ubuntu/simple/vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php on line 124
Fatal error: Class 'Illuminate\View\Environment' not found in /home/ubuntu/simple/vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php on line 124
vendor/bin/phpunit returned exit code 255
The composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.1.29",
"cartalyst/sentry": "2.1.*",
"vespakoen/menu": "dev-master",
"venturecraft/revisionable": "1.8.*",
"dompdf/dompdf" : "0.6.*",
"baum/baum": "~1.0",
"thujohn/pdf": "dev-master",
"yohang/finite": "1.1.x-dev",
"pimple/pimple": "2.1.*#dev",
"symfony/security": "2.4.x-dev",
"maatwebsite/excel": "1.*",
"codesleeve/asset-pipeline": "dev-master"
},
"repositories": [
{
"type": "composer",
"url": "http://packages.cartalyst.com"
}
],
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php",
"app/lib"
],
"psr-0": {
"Authority": "app/",
"Acme": "app/"
}
},
"config": {
"preferred-install": "dist",
"frozennode/administrator": "dev-master"
},
"require-dev": {
"barryvdh/laravel-debugbar": "1.*",
"way/generators": "2.*",
"codeception/codeception":"#stable",
"zizaco/factory-muff": "dev-master",
"zizaco/testcases-laravel": "dev-master",
"mockery/mockery": "dev-master",
"phpspec/phpspec": "~2.0",
"behat/behat": "~2.5.1",
"behat/mink": "~1.5.0",
"behat/mink-extension": "~1.2.0",
"behat/mink-goutte-driver": "~1.0.9",
"behat/mink-selenium2-driver": "~1.1.1",
"phpunit/phpunit": "3.7.37",
"onigoetz/profiler":"dev-master",
"benconstable/phpspec-laravel": "~1.0"
},
"minimum-stability": "beta"
}
The circle.yml file
machine:
timezone:
Africa/Johannesburg
php:
version: 5.4.21
hosts:
app.test: 127.0.0.1
test:
override:
- vendor/bin/phpunit

Did you try to run composer before? Try to put this in your circleci.yml:
dependencies:
override:
- composer install --prefer-source --no-interaction --no-dev

Related

Symfony - why "There is no extension able to load the configuration for "when#dev" "

I'm in deep over my head here trying to move into symfony flex finally. I'm following along with the symfonycast here (https://symfonycasts.com/screencast/symfony4-upgrade/flex-alive#play) moving step-by-step but I get an error where he has none and was wondering if I could get a hint as to where I've gone wrong.
upon running php bin/console I am hit by:
In FileLoader.php line 180:
There is no extension able to load the configuration for "when#dev" (in "/Users/mattias/Documents/www/webtools/config/package
s/monolog.yaml"). Looked for namespace "when#dev", found ""doctrine_cache", "doctrine", "fos_user", "sensio_framework_extra",
"monolog", "swiftmailer", "framework", "twig", "security"" in /Users/mattias/Documents/www/webtools/config/packages/monolog.
yaml (which is loaded in resource "/Users/mattias/Documents/www/webtools/config/packages/monolog.yaml").
In YamlFileLoader.php line 722:
There is no extension able to load the configuration for "when#dev" (in "/Users/mattias/Documents/www/webtools/config/package
s/monolog.yaml"). Looked for namespace "when#dev", found ""doctrine_cache", "doctrine", "fos_user", "sensio_framework_extra",
"monolog", "swiftmailer", "framework", "twig", "security"".
If I remove the when#dev from the monolog.yml file the same error appears with the next section instead (the when#test) so I assume there is some main wireing that hasn't been done etc.
I've googled the error but I seem to be the first one 😂
It seems as though I've ended up with monolog config for sym 5 so I wonder whether that tutorial is inaccurate in one of the composer directives. I might need to restrict some component to an earlier version when using it these days?
Here's my composer.json:
{
"name": "a/b",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-4": {
"AppBundle\\": "src/AppBundle",
"App\\": "src/"
},
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"autoload-dev": {
"psr-4": {
"Tests\\AppBundle\\": "tests/AppBundle",
"App\\Tests\\": "tests/"
}
},
"repositories": [
{
"type": "package",
"package": {
"name": "jquery/jquery",
"version": "1.11.1",
"dist": {
"url": "https://code.jquery.com/jquery-1.11.1.js",
"type": "file"
}
}
}
],
"require": {
"php": "^7.1.3",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"doctrine/orm": "^2.5",
"friendsofsymfony/user-bundle": "~2.1",
"sensio/framework-extra-bundle": "^5.0.0",
"symfony/console": "^4.0",
"symfony/flex": "^1.19",
"symfony/framework-bundle": "^4.0",
"symfony/lts": "^4#dev",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/yaml": "^4.0",
"twig/twig": "^1.0||^2.0"
},
"require-dev": {
"symfony/dotenv": "^4.0",
"symfony/phpunit-bridge": "^4.0"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true,
"allow-plugins": {
"symfony/flex": true
}
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"id": "",
"allow-contrib": false
}
}
}
The configuration is not handled by the bundle (monolog in this case), but by flex itself.
After package installation it runs "recipes" that take care of creating configuration, assets, etc. You can find the recipe for the monolog version here. There's no when# directive to be found until 3.7 but composer.json declares ^3.1.0.
Use composer show symfony/monolog-bundle to see what version is installed, but I doubt there will be a problem in the version resolution. You can try to nuke vendor/ and reinstall all packages.
The easiest way to go about it is to delete config/packages/monolog.yaml. since you should have your old configuration under confib/packages/{dev,prod,test}/monolog.yaml everything should continue working. If that's not the case you can always reinstall the recipe with composer recipes:install symfony/monolog-bundle --force to bring it back.
As for the tutorial itself, on a brief glance everything seems okay so far.
And keep in mind that the ability to parse when directives comes from framework-bundle >= 5.3. If you plan to upgrade all the way up you might want to reinstall recipes to pull in the latests configs (or maybe use composer recipes:update for an interactive, git-based update). Having all configs in one file is only a matter of convenience if the changes are small per environment, but everything will work just the same.

Call to undefined method App\Console\Kernel::load() - Laravel 5.4

I downgraded my application from 5.5 to 5.4 and i am getting this error when i run php artisan serve
Call to undefined method App\Console\Kernel::load() - Laravel 5.4
Looking at other solutions, i run composer dump-autoload to resolve this issue but the issue persist. Same error. I don't really know if this is caused by my packages in the composer.json file posted below
What could i do to resolve this now?
Thanks in advance
Composer.Json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"barryvdh/laravel-dompdf": "0.8.*",
"fideloper/proxy": "~4.0",
"guzzle/guzzle": "~3.0",
"laravel/framework": "5.4.*",
"laravel/passport": "^3.0",
"laravel/tinker": "~1.0",
"laravelcollective/html": "~5.0",
"maatwebsite/excel": " ~2.1.0",
"pda/pheanstalk": "~2.0",
"picqer/php-barcode-generator": "^0.2.0",
"spatie/laravel-permission": "^2.12",
"yajra/laravel-datatables-oracle": "~8.0"
},
"require-dev": {
"filp/whoops": "~2.0",
"nunomaduro/collision": "~1.1",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~7.0",
"symfony/thanks": "^1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories",
"app/commands",
"app/models",
"app/database/seeds",
"app/tests/TestCase.php"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
The issue is you did not ensure you updated your code to be Laravel 5.4 compatible.
In the Kernel.php boilerplate that comes with Laravel 5.5+ there's the line
$this->load(__DIR__.'/Commands');
This command was added in 5.5 to automatically detect any commands in the app/Console/Commands directory.
In order to get this code to work in 5.4 you need to remove that line and register all your commands manually under the protected $commands = [ ] array in the same file.
The source code for load is in https://github.com/laravel/framework/blob/5.5/src/Illuminate/Foundation/Console/Kernel.php#L196 if you want to try to adapt it and put it in your own Kernel.php
Delete vendor folder and composer.lock file after run composer install command
Go to your_project/app/Console/Kernel.php and remove line
$this->load(DIR.'/Commands');
in commands() function

Laravel 5.2 | Issue with bootstrap/cache/compiled.php

Good afternoon,
I had a time with a problem running composer update in my production repository. Only in production, in DEV and PRE does not happen to me, everyone has the same configuration and at the end pull almost the same repository and share composer.json
I'm using "laravel / framework": "5.2. *", With PHP 7.0
The problem I have is that when launching composer update, I generate this file, bootstrap / cache / compiled.php but only in PROD, in neither of the other versions generates it, nor in local. With this file loaded the application gives an error 500 and reports this failure:
PHP Fatal error: Can not declare class Illuminate \ Support \ ServiceProvider, because the name is already in use in /var/www/vhosts/proyecto/bootstrap/cache/compiled.php on line 5267
If I delete this file by hand the application works again, but this should not happen, in addition, the applications that I try to install with composer, since I have this bug, do not work, I declare them in config / app.php and check that this The folder in vendor and everything is correct, but it gives another 500 so the reason why it does not erase or generate bootstrap / cache / compiled.php makes the installations do not end up being correct.
Please, could you help me, I do not know what else to look or do ....
This is my composer file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"twbs/bootstrap": "^3.3",
"laravelcollective/html": "5.2.*",
"joshcam/mysqli-database-class": "dev-master",
"opentok/opentok": "2.3.x",
"intervention/image": "^2.3",
"hisorange/browser-detect": "2.*",
"ignited/laravel-omnipay": "2.*",
"omnipay/omnipay": "*",
"skecskes/calendar": "0.2.*",
"webpatser/laravel-uuid": "^2.0",
"barryvdh/laravel-debugbar": "^2.2",
"maatwebsite/excel": "~2.1.0",
"paypal/rest-api-sdk-php": "*",
"laracasts/flash": "^2.0",
"doctrine/dbal": "^2.5",
"laravel/cashier": "~6.0",
"barryvdh/laravel-dompdf": "0.7.*",
"dompdf/dompdf": "^0.7",
"ovh/ovh": "^2.0",
"docusign/esign-client": "^2.0",
"sentry/sentry": "^1.6",
"sentry/sentry-laravel": "^0.7.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
Thank you very much,
greetings
Update 2017/06/15 08:00 CEST
Remove, one by one the third party package from the require/requir_dev section and retry composer update
Mostly, third party packages cause this error. You can do the following things:
Run php artisan clear-compiled and retry composer update
Remove the generated service provider from compiled.php and retry composer update
Make a fresh installation
You're using PHP 7.0. It's not forbidden (I recommend) to use a newer version of Laravel!

Installing Facebook-php-ads-sdk in cakephp 3 with composer

Ok, im quite lost with Composer and Cakephp 3.0. Im trying to install
https://github.com/facebook/facebook-php-ads-sdk
on my project, did all modifications on composer.json:
{
"name": "cakephp/app",
"description": "CakePHP skeleton app",
"homepage": "http://cakephp.org",
"type": "project",
"license": "MIT",
"require": {
"php": ">=5.4.16",
"cakephp/cakephp": "~3.0",
"mobiledetect/mobiledetectlib": "2.*",
"cakephp/migrations": "~1.0",
"cakephp/plugin-installer": "*",
"facebook/php-ads-sdk": "2.3.*"
},
"require-dev": {
"psy/psysh": "#stable",
"cakephp/debug_kit": "~3.0",
"cakephp/bake": "~1.0"
},
"suggest": {
"phpunit/phpunit": "Allows automated tests to be run without system-wide install.",
"cakephp/cakephp-codesniffer": "Allows to check the code against the coding standards used in CakePHP."
},
"autoload": {
"psr-4": {
"App\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"App\\Test\\": "tests",
"Cake\\Test\\": "./vendor/cakephp/cakephp/tests"
}
},
"scripts": {
"post-install-cmd": "App\\Console\\Installer::postInstall",
"post-autoload-dump": "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
},
"minimum-stability": "dev",
"prefer-stable": true
}
RUnning the composer im having no changes and no installation.
What im doing wrong ?
Ok.. the process is quite simple, and JUST READ THE MANUAL
Step 1:
Update your composer.json adding:
"facebook/php-ads-sdk": "2.3.*"
inside "require".
Step 2:
run composer update
Step 3:
go inside vendor/facebook/php-ads-sdk and run:
composer install --no-dev
Step 4:
update your composer.json adding:
"classmap": [
"vendor/facebook/php-ads-sdk"
]
inside "autoload: {}"
Step 5:
run
composer dump-autoload
PROFIT

php composer.phar update failed - A typo in the package name

I have created a new Symfony 2.1 project and added a custom package downloaded by a SVN repo.
Now I'm tryng to upgrade the project to Symfony 2.2, but anytime I try to execute the command php ~/bin/composer.phar update the following error message appears:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package custom/utils could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
This is Symfony 2.2 composer.json:
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"repositories": [
{
"type": "vcs",
"url": "svn+ssh://sources.de.ext/usr/local/svnroot/utils"
}
],
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.2.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.2.*",
"symfony/monolog-bundle": "2.2.*",
"sensio/distribution-bundle": "2.2.*",
"sensio/framework-extra-bundle": "2.2.*",
"sensio/generator-bundle": "2.2.*",
"jms/security-extra-bundle": "1.4.*",
"jms/di-extra-bundle": "1.3.*",
"custom/utils": "*"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "alpha",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"branch-alias": {
"dev-master": "2.2-dev"
}
}
}
Custom utils have following composer.json:
{
"name": "custom/utils",
"version": "1.0.0",
"description": "The Custom Libraries",
"autoload": {
"psr-0": {
"Blogo": "src/",
"WideImage": "lib/"
}
},
"require": {
"symfony/console": "2.*",
"symfony/yaml": "2.*"
}
}
Could anyone help me to understand what's wrong in new 2.2 Symfony? Because this error message appear only Symfony 2.2 upgrade.
Try running composer update --verbose or composer show custom/utils --verbose. Both will show you some output about the loading of your SVN repository. It should indicate which versions are loaded or not.
My guess is that you have a dev-trunk version available, and if you require it it will most likely work. You should not specify version: 1.0.0 in your composer.json, because composer reads the version information from tags/branches in your VCS.

Categories