Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

laravel new blog not work mockery/mockery 1.4.0

Today I wanted to create a new project with Laravel with this command

laravel new blog

But I get this error

Crafting application...
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
    - Installation request for mockery/mockery 1.4.0 -> satisfiable by mockery/mockery[1.4.0].
    - mockery/mockery 1.4.0 requires php ^7.3.0 -> your PHP version (7.2.23) does not satisfy that requirement.

Why should php7.3 be read when Laravel himself says at least php7.2.5 ???

like image 625
Parsa Haghighi Avatar asked May 19 '20 21:05

Parsa Haghighi


People also ask

What happens when a method is not mocked in Laravel?

The methods that are not mocked will be executed normally when called: Similarly, if you want to spy on an object, Laravel's base test case class offers a spy method as a convenient wrapper around the Mockery::spy method.

How to mock the call to the cache facade in Laravel?

We can mock the call to the Cache facade by using the shouldReceive method, which will return an instance of a Mockery mock. Since facades are actually resolved and managed by the Laravel service container, they have much more testability than a typical static class. For example, let's mock our call to the Cache facade's get method: // ...

What version of PHP do I need to run mockery?

You've got 7.2.23 installed, and mockery/mockery 1.4 requires 7.3.0 The best solution is to upgrade your PHP version. Alternatively, you can reduce mockery's version to 1.3.1, which only requires PHP 5.6 or above.

Why can't I run mockery on my computer?

Your PHP version is too low. You've got 7.2.23 installed, and mockery/mockery 1.4 requires 7.3.0 The best solution is to upgrade your PHP version. Alternatively, you can reduce mockery's version to 1.3.1, which only requires PHP 5.6 or above.


2 Answers

Run composer update.

The reason:

Your PHP version is too low. You've got 7.2.23 installed, and mockery/mockery 1.4 requires 7.3.0

The best solution is to upgrade your PHP version. Alternatively, you can reduce mockery's version to 1.3.1, which only requires PHP 5.6 or above.

My bug report can be found here

As of 2020-05-21, the zip files that laravel new ___ uses will try to install mockery/mockery version 1.4. This won't work with versions of PHP below 7.3. In order to fix this, run composer update, and mockery will be downgraded to a compatible version.

like image 173
Joundill Avatar answered Oct 21 '22 10:10

Joundill


Delete the composer.lock file and run composer again

composer install

like image 21
shaher11 Avatar answered Oct 21 '22 10:10

shaher11