does anyone already tried phpunit with php7 methods type hints? I got an issue mocking class with typoe hinted method's like
PHP Fatal error: Declaration of Mockery_0_Forms_Fields_TextField::getSettings() must be compatible with AbstractField::getSettings(): array in /home/n1ks2n/vagrant/$project-name/vendor/mockery/mockery/library/Mockery/Loader/EvalLoader.php(16) : eval()'d code on line 25
Beacuse i have methods like public function getSettings() : string {/**code here*/} in my code. Think that mockery doesn't yet know how to work with this. Maybe someone has a solution how to tell mocked class that this methods should return even type?
So i found a solution myself. The problem is about mockery vendor package version 0.9.4 or above. Just need to change "0.9.*" to "dev-master" in composer.json. This problem will be solved in the next release of mockery pckage.
Related
I had this error "Invalid route action: [C:32:\"Opis\\Closure\\Serializable Closure\" while I was making a test closure function in the routes file and I have no clue what is going wrong
php artisan optimize did it for me!
I have checked most of the answers and nothing satisfied my curiosity but due to my deadline I can't investigate a lot so :
This worked for me, basically never write a closure function in the routes file !
I will update if I dug deeper and found a real solution but I solved my problem with this now
Just creating a test function into the controller and that's it
I didn't change any backend code .I dont know it triggers when I hit any url of laravel app it will show this error.I dont know why this happend and also need solution for this .My laravel version in 5.8 and php 7.2
Fatal error : Class Illuminate\Routing\RouteCollection contains 1 abstract method and must therefore be declared abstract or implement the remaining methods C:\xampp\htdocs\pmf\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php on line 14 this is file it is saying.
Reinstall or update composer wont solve the problem. In my case, you just need to restart the local development server, because the problem is just temporary.
Just need to restart the local development server.
Doing the Larcast tutorial for "Build a laravel App with TDD" and when i added the $response->assertRedirect(Project::where($attributes)->first()->path());
i started getting the following:
Error : Call to undefined method phpDocumentor\Reflection\Project::where()
How do i resolve this, struggling to find the resolution anywhere else, i have added it to the laracast tutorial itself but no answer.
Tried chasing the answer on the laracasts site.
My tests should pass. (the functionality actually works but i want the test in place to prove it does)
You are using the wrong import for the Project so on top of the test class put this:
use App\Project;
I've got a site on Codeigniter 2 and when I switch server's version to PHP7 I get the following two errors:
A PHP Error was encountered
Severity: Notice
Message: Only variables should be assigned by reference
Filename: core/Controller.php
Line Number: 51
$this->load->_base_classes =& is_loaded();
A PHP Error was encountered
Severity: 8192
Message: Methods with the same name as their class will not be constructors in a future version of PHP; CI_DB_driver has a deprecated constructor
Filename: database/DB_driver.php
Line Number: 31
Does anyone know how to fix them?
Eventually I just updated CI core to CodeIgniter 2.2.6. Had to change DB driver to mysqli (since mysql is no longer supported in php7) and re-added the ci_sessions table in database (no idea why). And works like a charm!
Only variables should be assigned by reference
This error isn't PHP 7-exclusive, you'd get it in older versions too. Anyway, I think the issue here is in is_loaded() and it is not returning a reference properly. Does it return by-reference (is it like function &is_loaded())? If not, it needs to. Does it return a variable or an expression? If it's not a variable, you need to put it in one before you can return a reference to it.
PHP manual page for this error: http://php.net/manual/en/language.references.return.php
Methods with the same name as their class will not be constructors in a future version of PHP; CI_DB_driver has a deprecated constructor
In PHP 4, you made a constructor method by naming it the same as the class. So if your class was class FooBar, your constructor would be public function FooBar. In PHP 5 and beyond, though, the recommended name for a constructor is __construct. So, go and edit that class and rename its constructor to get rid of the deprecation errors. Be sure to look at any extending classes to see if they call that constructor method, too, so you can change them.
See the upgrading guide: http://php.net/manual/en/migration70.deprecated.php
Also see the RFC: https://wiki.php.net/rfc/remove_php4_constructors
I have installed yoothemes zoo 3.11.The installed message indicated that everything went in correctly but when I go to the component i get this following error:
Fatal error: Class 'JControllerLegacy' not found in
/home/p446072r/public_html/administrator/components/com_zoo/framework/classes/controller.php
on line 17
The JControllerLegacy class was added in Joomla 2.5.6. Upgrade to that, and you'll be fine. If you're not able to upgrade, you could also define the classes yourself, since they are just a shell that extends JController. However, the recommended way would be to upgrade to at least 2.5.6.