phpunit and CodeCoverage - php

I'm running a vagrant box w/ a simple lamp stack. I've installed phpunit globally via composer :
composer global require "phpunit/phpunit=4.1.*"
When I run phpunit I get the following error:
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/share/php/PHPUnit/Autoload.php on line 46
HP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='/home/vagrant/.composer/vendor/phpunit/php-text-template:/home/vagrant/.composer/vendor/phpunit/phpunit-mock-objects:/home/vagrant/.composer/vendor/phpunit/php-timer:/home/vagrant/.composer/vendor/phpunit/php-token-stream:/home/vagrant/.composer/vendor/phpunit/php-file-iterator:/home/vagrant/.composer/vendor/phpunit/php-code-coverage:/home/vagrant/.composer/vendor/phpunit/phpunit:/home/vagrant/.composer/vendor/symfony/yaml:.:/usr/share/php:/usr/share/pear') in /usr/share/php/PHPUnit/Autoload.php on line 46
My research seems to imply that it's a problem with CodeCoverage not installing, but I'm having problems trying to get that installed. I've tried to install via composer and can't get it working.
Via Composer, I've tried adding to the global:
composer global require "phpunit/php-code-coverage": "3.0.*#dev"
and I get this output:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package phpunit/php-code-coverage could not be found in any version, there may be a typo in the package name.
Problem 2
- phpunit/phpunit 4.1.3 requires phpunit/php-code-coverage ~2.0 -> no matching package found.
- phpunit/phpunit 4.1.3 requires phpunit/php-code-coverage ~2.0 -> no matching package found.
- Installation request for phpunit/phpunit == 4.1.3.0 -> satisfiable by phpunit/phpunit[4.1.3].
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.
Installation failed, reverting ./composer.json to its original content.
No clue what I'm doing wrong!

you need to reinstall code-coverage 2.0 first
composer global require "phpunit/php-code-coverage":"2.0.*#dev"
then you install phpunit
composer global require "phpunit/phpunit=4.1.*"

Related

Why can't I bind Elasticsearch and Laravel Scout?

I decided to test Elasticsearch in conjunction with Laravel Scout. I took this article as a basis
Attempt #1
composer require elasticsearch/elasticsearch - installing ES for Laravel
composer require laravel/scout - installing latest version for Scout (9.1)
composer require tamayo/laravel-scout-elastic - installing package for ES+Scout
I get this error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- tamayo/laravel-scout-elastic[8.0.0, ..., 8.0.2] require laravel/scout ^8.0 -> found laravel/scout[v8.0.0, ..., 8.x-dev] but it conflicts with your root composer.json require (^9.1).
- Root composer.json requires tamayo/laravel-scout-elastic ^8.0 -> satisfiable by tamayo/laravel-scout-elastic[8.0.0, 8.0.1, 8.0.2].
I understand for myself that this bundle package has not been updated on github for six months and it is necessary to get to it the necessary version of laravel/scout, so I change the order of actions and do so:
Attempt #2
composer require elasticsearch/elasticsearch - installing ES for Laravel
composer require tamayo/laravel-scout-elastic - installing this package hoping that he will get the necessary version of laravel/scout for himself as a dependency, in confirmation of this - I see in the console that he pulled up laravel/scout:8.6.1
Now no mistakes, I'm moving on:
I go to config/app.php and add:
Laravel\Scout\ScoutServiceProvider::class,
ScoutEngines\Elasticsearch\ElasticsearchProvider::class,
Run php artisan vendor:publish
And now I get new error:
Class 'ScoutElastic\ScoutElasticServiceProvider' not found
What am I doing wrong?
Solution: don't add ScoutEngines\Elasticsearch\Elastic search Provider:: class, to config/app.php
Everything works fine without adding this provider

Failed while installing a package using composer

iam tryin to use a cart package by using this command
composer require jason-napolitano/codeigniter4-cart-module
and it's failed. this is what it said
Using version dev-master for jason-napolitano/codeigniter4-cart-module
./composer.json has been updated
Running composer update jason-napolitano/codeigniter4-cart-module
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires jason-napolitano/codeigniter4-cart-module dev-master -> satisfiable by jason-napolitano/codeigniter4-cart-module[dev-master].
- jason-napolitano/codeigniter4-cart-module dev-master requires codeigniter4/framework ^4.0.3 -> satisfiable by codeigniter4/framework[v4.0.3, ..., v4.1.1] from composer repo (https://repo.packagist.org) but codeigniter4/framework[1.0.0+no-version-set] from root package repo has higher repository priority. The
packages with higher priority do not match your constraint and are therefore not installable. See https://getcomposer.org/repoprio for details and assistance.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
is it because my minimum-stability in composer.json is set to "stable"?
I presume you created your project by using composer create-project codeigniter4/framework. This effectively created a clean project for you without the .git folder, thus removing any metadata on what version of codeigniter4/framework package you installed. This is indicative by 1.0.0+no-version-set part of the error message.
The jason-napolitano/codeigniter4-cart-module package requires ^4.0.3 version of codeigniter4/framework, but since you have no version metadata in your project, install fails. This can be resolved by setting the version from which you bootstrapped your project manually in your root composer.json:
{
"name": "codeigniter4/framework",
"version": "4.0.3",
...
}
However, this is just a guess, since I have no insight into your main composer.json.
Your PHP is missing intl extension. It is useful for formatting currency, number and date/time as well as UCA-conformant collations, for message formatting and normalizing text..etc.
Check out Codeignitor 4 [Documentation][1]:
Follow the steps to install it in XAMPP -
Open [xampp_folder_path]/php/php.ini to edit.
Search for ;extension=intl and remove the ;.
Save the php.ini file and restart Apache.

Laravel: Install Microsoft Azure Client Library with composer

Does anyone installed Microsoft Azure Client Library to a Laravel 5 project with composer on an Ubuntu server?
When I try to install with Composer (command: composer require microsoft/windowsazure), I got the next error:
Using version ^0.4.1 for microsoft/windowsazure
./composer.json has been updated
> php artisan clear-compiled
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
- Installation request for microsoft/windowsazure ^0.4.1 -> satisfiable by microsoft/windowsazure[v0.4.1].
- microsoft/windowsazure v0.4.1 requires pear-pear2.php.net/http_request2 * -> no matching package found.
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://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
Does anyone know what am I doing wrong?
Thanks for the help.
The problem was solved by modifying the config of the composer, by setting the secure-http to false
"config": {
"secure-http": "false"
}

Laravel/Illuminate Fatal Error

I got a web app that works on my local computer, but not on my server. I get this error on server. I checked the code that the error mentions about, and there's nothing wrong with it.
Do you have any idea what causes this?
Thank you very much in advance.
Here's my error message:
Fatal error: Interface 'Illuminate\Exception\ExceptionDisplayerInterface' not found in /var/www/test-app.domain.com/public_html/vendor/laravel/framework/src/Illuminate/Exception/SymfonyDisplayer.php on line 6
Here's SymphonyDisplayer.php's line 6:
class SymfonyDisplayer implements ExceptionDisplayerInterface {
It says that there's no ExceptionDisplayerInterface. However, it's right next to this file, in the same directory. ExceptionDisplayerInterface.php is in Exception folder with SymphonyDisplayer.php
Here's my composer install output:
>>composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- jeremeamia/SuperClosure 1.0.1 requires nikic/php-parser ~0.9 -> no matching package found.
- jeremeamia/SuperClosure 1.0.1 requires nikic/php-parser ~0.9 -> no matching package found.
- Installation request for jeremeamia/superclosure 1.0.1 -> satisfiable by jeremeamia/SuperClosure[1.0.1].
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.
Here's a new error after executing composer update:
Fatal error: Interface 'Whoops\Handler\HandlerInterface' not found in /var/www/test-app.domain.com/public_html/vendor/filp/whoops/src/Whoops/Handler/Handler.php on line 17
Here's some more outputs while trying to figure out the problem:
>>composer diagnose
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: OK
Checking composer.json: OK
Checking disk free space: OK
Checking composer version: OK
>>composer self-update
You are already using composer version 0d4c2bb7d7a864a9b3e876908e743310cdeaa5e6.
Phew. I fixed it.
Here's how I did it, if anyone else sees this type of error message:
rm -rf vendor && composer update -v
I guess my vendor directory went nuts while I was doing some stuff with SFTP yesterday.
Thanks everyone.

zend framework 2 composer.php

when I try to install webino-image-thumb using zend php composer it gave me this error
php composer.phar require webino/webino-image-thumb:2.*<br/>
./composer.json has been updated<br/>
Loading composer repositories with package information<br/>
Ignoring unknown parameter "server role"<br/>
Updating dependencies (including require-dev)<br/>
Your requirements could not be resolved to an installable set of packages.<br/><br/>
Problem 1<br/>
- Can only install one of: zf-commons/zfc-admin[v0.1.0, dev-master].<br/>
- Can only install one of: zf-commons/zfc-admin[v0.1.0, dev-master].<br/>
- Installation request for zf-commons/zfc-admin 0.1.0 -> satisfiable by zf-commons/zfc-admin[v0.1.0].<br/>
- Installation request for zf-commons/zfc-admin == 9999999-dev -> satisfiable by zf-commons/zfc-admin[dev-master].<br/>Any help<br/>Lanka
Just replace "webino/webino-image-thumb":"2.*" by "webino/webino-image-thumb":"1.*"
Composer filters packages by stability and by default it requires a minimum stability of stable. You can change this to RC since webino-image-thumb is 2.0.0-RC1 at the time of writing this or just use the 1.* stable release. Check the doc here

Categories