I installed phpunit-selenium using composer according to here; https://phpunit.de/manual/3.7/en/selenium.html
The problem is that I only have selenium 2 for phpunit. PHPUnit_Extensions_Selenium2TestCase.php is there. But the file PHPUnit_Extensions_SeleniumTestCase.php does not exist in the extension map where it supposed to be. So selenium 1 function can not be used.
How can I get selenium 1 for php unit using composer (on a windows machine)?
I know there is an answer involving pear; How do I solve this error: "Class PHPUnit_Extensions_SeleniumTestCase could not be found"
But pear is not preferred because composer is shared with the team. It would save installing it.
Solved it. I needed to move back a version in phpunit-selenium:
"require-dev": {
"phpunit/phpunit-selenium": "1.4.*"
}
instead of using the latest version which probably only works with selenium 2.
"require-dev": {
"phpunit/phpunit-selenium": ">=1.2"
}
Related
I recently updated a Laravel/Spark web application to the latest version of Spark (v9.*) via composer. Another package I use is Laravel-Spark-Google2FA which I also updated from v1.* to v2.*.
Setup:
The laravel-spark-google2fa package has a Laravel service provider class that resides in /project-root/laravel/spark/src/Providers/Google2FAServiceProvider.php
In Laravel we specify this in /project-root/laravel/config/app.php with the following line in the providers array:
Laravel\Spark\Providers\Google2FAServiceProvider::class,
In composer.json we have:
"require": {
...
"doctrine/dbal": "^2.5",
"laravel/framework": "^6.0.0",
"eusebiu/laravel-spark-google2fa": "^2.0.0",
"laravel/cashier": "^10.0.0",
"laravel/spark-aurelius": "^9.0.0",
"laravel/tinker": "^1.0.0",
"laravelcollective/html": "^6.0.0",
"webpatser/laravel-uuid": "2.*"
},
"autoload": {
...
"psr-4": {
"App\\": "app/"
}
},
...
Note: aside from the higher version numbers you see above in the require section, this has been the setup for a long time with the web application running successfully during that time.
Error:
Since we upgraded laravel/spark to laravel/spark-aurelius: ^9.0.0 we've run into one error which prevents the application from running:
In ProviderRepository.php line 208:
Class 'Laravel\Spark\Providers\Google2FAServiceProvider' not found
Failed attempts
We have tried the following to fix this, none of which have worked:
running php artisan config:clear
running php artisan cache:clear
running composer dump-autoload
as per laravel-spark-google2fa docs, running php artisan vendor:publish --provider="Eusebiu\LaravelSparkGoogle2FA\Google2FAServiceProvider" --force
changing how the service provider is specified in app.php
added a new path to autoload in composer.json
downgrading laravel-spark-google2fa to an earlier version
removing and re-installing laravel-spark-google2fa
running spark-installer over the existing application
In all of the above cases the error remains, preventing the application from running.
The laravel-spark-google2fa package may be recently abandoned. I opened an issue there and haven't heard a reply. Laravel/Spark support has not suggested a solution. So I am posting here as a last resort before getting rid of this package and refactoring my code to use a different one.
I was unaware of the bootstrap cache. The bootstrap cache file contained a reference to the Google2FAServiceProvider service provider class which after various package updates and what not was no longer present.
Running commands like php artisan config:clear, php artisan cache:clear, and composer dump-autoload did not clear this cache. In the end, I simply removed the offending file:
filename: services.php
location: /laravel/bootstrap/cache/services.php
config.php, in the same location, can also contain such references.
Note: I used the find feature in VSCode to look for references to this service provider and it did not find this one because the bootstrap cache is gitignored.
I've got a problem with PhpStorm, composer and PHPUnit.
Windows 8.1 Pro (64 bit)
PhpStorm is up to date: 2018.2.2
Tried different PHP interpreters like XAMPP and a clean PHP for win
PHPUnit is required by composer with: "phpunit/phpunit": "^7.3.3".
PHPUnit is successfully installed via composer to the vendor directory as well.
PHPUnit is recognized from PhpStorm:
My test class extends the PhpUnit\Framework\TestCase class and when you run the test, the following happens:
First it seems like PhpStorm loads the old PHPUnit (3.7.21) from XAMPP's PHP and not the recognized PHPUnit (7.3.3) as setup in the PhpStorm settings / installed to the vendor folder.
But I don't think so.
I think PhpStorm tries to load the PhpUnit\Framework\TestCase class by the autoloader, but I don't know why it doesn't find the PHPUnit...
Thanks in advance!
The whole project could be minimized to this simple test class:
The composer.json looks like the following:
"autoload": {
"psr-4": {
"Flo\\Newsletter\\": "src/"
}
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.3.3"
}
Namespaces are case-sensitive. Please change PhpUnit to PHPUnit in the import.
Although PhpStorm could really detect that. Here's a feature request for that: https://youtrack.jetbrains.com/issue/WI-38140
I have configuration:
Open Server 5.2.8 (WAMP)
PhpStorm 2017.3.4
Yii 2.0.14 basic
I added to the %PATH% path to PHP and to the Codeception folder:
In the PhpStorm terminal I launched the codecept run command and everything looks good. But the Windows terminal does not maintain colors therefore I wanted to launch tests through PhpStorm.
I made such settings for PHPUnit and Codeception (from Yii2\vendor):
But for some reason I receive such error:
You are missing the dependency for phpunit, add the following to your composer.json
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
and run
composer update
Answers here and here. Thanks to #panosru.
Just download new version PHPStorm 2017.3.6.
I am trying to implement the Graphaware\neo4j client in php
neo4j-php-client
I ran composer to download the files to the working directory .www
and tried initiating the client using
require_once(BASEPATH.'vendor/autoload.php');
use GraphAware\Neo4j\Client\ClientBuilder;
$client = ClientBuilder::create()->addConnection('default', 'http://neo4j:myPassword#localhost:7474')->build();
I get this error.
<b>Fatal error</b>: Class 'GraphAware\Neo4j\Client\ClientBuilder' not found in <b>*path_to_my_www_dir\index.php*</b> on line <b>36</b><br />
Why am i seeing this?
I'm the maintainer of GraphAware Neo4j Client.
My bet is that you have been disturbed when reading the README of the repository.
The current master branch contains the code for 4.0#alpha, so if you ran in the command line composer require graphaware/neo4j-php-client chances are high that composer installed the last stable version in the 3.X series and thus the required class doesn't exist there.
I would suggest you try to install the alpha7 version of the client by running :
composer require graphaware/neo4j-php-client:^4.0#alpha
Let me know if you have other issues
We ran into the issue with neo4j-php-client not supporting PHP 5.5 as well. While the "correct" solution is to upgrade to a newer version of PHP, it isn't exactly the most convenient--especially if you just want to start evaluating this library. The only reason that PHP >= 5.6 is required is for Neo4j's bolt protocol, so as long as you stick to using the http protocol instead everything will work fine. In order to get composer to play nice though, you have to make a few changes to neo4j-php-client's composer.json:
Change "php": ">= 5.6" to "php": ">= 5.5"
Replace "graphaware/neo4j-bolt": "^1.5" with "graphaware/neo4j-common": "^3.0"
We ended up forking the library on Github and then updated our composer.json to use our modified version of neo4j-php-client. The relevant parts are:
{
...
"require": {
...
"graphaware/neo4j-php-client": "dev-OptionalBoltSupport"
},
...
"repositories": [
...
{
"type": "vcs",
"url": "https://github.com/wnielson/neo4j-php-client"
}
]
}
After doing this you can run composer update and neo4j-php-client should install fine.
You simply need to require vendor/autoload.php as said in documentation.
So require_once 'vendor/autoload.php'; will solve your problem.
The problem is that, even if you are using use ..., your php file didn't know anything about the php class file you're trying to create.
You need to include that file using include or require function.
Versioneye is a good way to track dependencies, I enjoy using it, however I've run into an issue:
My repository is for php 5.4 and greater which means I must use phpunit ~4.8
Versioneye however says my dependency for phpunit is outdated because 5.1.* is the latest, but you cannot run phpunit 5 on anything less than php 5.6.
Is there a way to specify in composer or anywhere else that on php 5.4/5.5 phpunit 4.8 should be used and on php 5.6 phpunit 5.1.* should be used?
Or do I simply go into versioneye and tell it not to consider 5.1.17 at all? But then I have to constantly keep that up-to-date.
Thanks for your help in advance, here are the git repo and version eye links:
https://github.com/thephpeffect/TriggrPHP
https://www.versioneye.com/user/projects/56b3ba5e0a0ff5002c85ed7b?child=summary
If you set the PHP version in composer.json it should update only the dependency to versions that are admitted in PHP 5.4. This would prevent the outdated libraries message, and you shouldn't need to care anymore:
"config" : {
"platform": {
"php": "5.4"
}
}
But AFAIK there is no way of choosing the version depending on the installed PHP version.
I found that if I used
"phpunit/phpunit": "~4.8|~5.1"
it automatically detects that 5.1 is an option regardless of php version and shows dependencies as up-to-date.