Testing after update: The plugin class `WyriHaximus\TwigView\Plugin` cannot be found - cakephp

I started update CakePHP 3.5 to 3.6, but when I try check my code by tests, i got error:
InvalidArgumentException: The plugin class Migrations\Plugin cannot be found. Ensure your autoloader is correct.
After, I runed command php composer.phar require --dev phpunit/phpunit:"^5.7|^6.0"
Now a got next error:
InvalidArgumentException: The plugin class WyriHaximus\TwigView\Plugin cannot be found. Ensure your autoloader is correct.
And I don't used this plugin before.
Also I used this release files for update deprecated code
How I can fix it, and what could provoke this problem?
Full error:
3) App\Test\TestCase\Controller\CardsControllerTest::testEditPostError
InvalidArgumentException: The plugin class `WyriHaximus\TwigView\Plugin` cannot be found. Ensure your autoloader is correct.
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\Http\BaseApplication.php:127
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\Http\BaseApplication.php:95
C:\work\OSPanel\domains\project.loc\vendor\cakephp\bake\src\Plugin.php:50
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\Http\BaseApplication.php:154
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\Http\Server.php:124
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\Http\Server.php:82
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\TestSuite\MiddlewareDispatcher.php:149
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\TestSuite\IntegrationTestCase.php:495
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\TestSuite\IntegrationTestCase.php:392
C:\work\OSPanel\domains\project.loc\tests\TestCase\Controller\CardsControllerTest.php:229
Thank you.

Make sure you have removed/commented Plugin::routes(); line from your config/routes.php file.

Related

CakePHP cms tutorial missing Helpers

Just starting with CakePHP and started the cms tutorial.
Install and configure went fine, but when I get to load the site for the first time there is a missing HTML Helper error.
When checking the View/Helper directory, it is empty: so obviously not installed.
What do I need to do to get the Helpers installed?
The issue was incorrect code in the ctp file (a stray character), and I incorrectly read the Error message as a missing Helper.
Core Helper was not actually missing, I just needed to read the Directory to discover the difference between core helpers and application helpers :-/

How to properly implement PHPWord to CakePHP?

I am trying to generate a word document using phpword through cakephp but I always get a fatal error:
Error: Class 'PhpOffice\PhpWord\TemplateProcessor' not found
File:C:\xampp\htdocs\thesis\app\Controller\MainController.php
Line: 1016
line 1016:
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_07_TemplateCloneRow.docx');
I placed the phpword files in this path:
C:\xampp\htdocs\thesis\app\Vendor
And the docx file here:
C:\xampp\htdocs\thesis\app\Vendor\PhpWord\resources
Is there anything wrong on how I implemented phpword with cakephp?
Thank you.
I think you should install PHPWord through Composer as CakePHP is using Composer to manage its dependancies.

Class 'SqlFormatter' is missing CAKEPHP 3 DebugKit

I've just installed the latest Debugkit from https://github.com/cakephp/debug_kit.
Everything is working. However, when I clicked on the "SQL Log", the CakePHP logo keeps spinning. I tried to debug by opening up the console.log and saw an 500 error. It shows the below.
Error: Class 'SqlFormatter' not found
File /Applications/MAMP/htdocs/App/vendor/cakephp/debug_kit/src/Template/Element/sql_log_panel.ctp
Line: 24
From my understanding, SqlFormatter class is not found in sql_log_panel.ctp. How can I add/declare the SqlFormatter class?
Just install it via composer, problem very likely solved then.
https://getcomposer.org/doc/00-intro.md
http://book.cakephp.org/3.0/en/installation.html#installing-cakephp
I highly recommend you to become familiar with composer, it is a standard tool for php developers for some time now. Composer will automatically install the dependencies for you.
Your second best option would be to download the SqlFormatter package manually from where ever it comes from and set your autoloading or include manually up.

PageableManagerInterface error in SonataAdminBundle

I'm trying to configure SonataAdminBundle and SonataUserBundle to use mongodb and am getting the following error:
ClassNotFoundException: Attempted to load interface "PageableManagerInterface" from namespace "Sonata\CoreBundle\Model" in /Users/me/Sites/mynamespace-webtools/vendor/sonata-project/user-bundle/Model/UserManagerInterface.php line 25. Do you need to "use" it from another namespace?
Can anyone shed any light on what might be causing this? I was also getting the symptoms described here and have tried the answers suggested there.
Can anyone confirm if the mongodb functionality is just broken? Am also wondering if this error relates to this commit?
This appears to be a dependency error within the Sonata system itself, and not strictly related to the MongoDB module.
The PageableManagerInterface class is provided by the Sonata Core Bundle. Make sure that you have it in your composer.json file:
"require": {
"sonata-project/core-bundle": "dev-master",
}
After that, make sure your install is up to date and clean your cache, as usual:
php composer.phar self-update ; php composer.phar update

CakePHP searching for DebugKit at wrong path

I am trying to import DebugKit and CakePHP is producing the following error: DebugKit.ToolbarComponent could not be found.
Right below it, it says:
Create the class ToolbarComponent below in file:
/Users/SomeUser/Sites/SomeProject/app/Plugin/DebugKit//Controller/Component/ToolbarComponent.php
If you notice though, there are two slashes between DebugKit and Controller for some reason, and that's obviously not a real directory. The server running PHP 5.4.17. I have followed the exact installation instructions listed here. Any suggestions?
I had the same problem and solved it by changing the permissions to 755 to folders within DebugKit.
When I encountered this problem, I realized I had a Plugin/DebugKit folder structure in my project's root, and under the app directory. The one under app was empty, save for a blank file called empty. Strange. I have no idea how this happened. (Perhaps from accidentally running composer as non-root?) I deleted app/Plugin/DebugKit, and moved the one from the project root into app. No more error.
DebugKit does not currently seem to be compatible with cakephp 3.0 even though it is the example in the documentation.
The latest version still seems to use the 2.x methods.
I will also submit a ticket regarding this to update their documentation to prevent confusion.
If there is something I missed regarding this issue and it is actually possible to install this, let me know.

Resources