PHPUnit intallation for CakePHP 2.4 - cakephp

Error that I'm getting when trying to run tests:
Fatal error: Class 'PHPUnit_Util_Diff' not found in Cake/TestSuite/Reporter/CakeHtmlReporter.php on line 267
As per this question, and the answers there, I need to install PHPUnit 3.6.x to avoid the missing Class error. How can I install this, now deprecated, version?
I've tried using composer like this:
composer global require "phpunit/phpunit=3.6.*"
But I get the following error
Problem 1
- The requested package phpunit/phpunit could not be found in any version, there may be a typo in the package name.
I've tried PEAR with this command:
sudo pear install phpunit/PHPUnit-3.6.12
but I get this error:
Attempting to discover channel "phpunit"...
Attempting fallback to https instead of http on channel "phpunit"...
unknown channel "phpunit" in "phpunit/phpunit-3.6.12"
invalid package name/package file "phpunit/phpunit-3.6.12"
install failed
I have found an answer here which points me to dereuromark's plugin, which is deprecated and suggests that I use composer since the pear channel for PHPUnit has been shutdown. Not to mention that it's version 3.7.x, which is missing the Class I need. So, I've come full circle.
tl;dr How do install PHPUnit 3.6.x for the CakePHP 2.4.x?
UPDATE: I checked that the same class is used in the latest CakePHP 2.x version. Also, I should mention that test ran correctly on a similar, but older VM that had the older PHPUnit installed.

TL;DR: PHPUnit 3.6 is no longer available for installation.
PHPUnit 3.6 was only ever available as a PEAR package. The PEAR Channel that hosted PHPUnit, pear.phpunit.de, was shut down on December 31, 2014.

I managed to workaround the issue. Since I wasn't able to install the deprecated PHPUnit version, I took the missing functions from the Diff class(diff, diffToArray and longestCommonSubsequence) and put them into the CakeHtmlReporter Class, since that was the only one referencing them.
After that I changed PHPUnit_Util_Diff::diff to self::diff and it's working now, even though it's missing the old CSS styles, but I can live with that.
It's not the answer to the question I asked, but maybe it can help someone else, until a better answer comes along.

Related

How to interpret suggestions when installing CakePHP via Composer?

When I try installing with command line:
composer self-update && composer create-project --prefer-dist cakephp/app my_app_name
I keep getting this message, which I didnt use to have, now which one is required, which one is not, do I have to download manually everytime?
cakephp/app suggests installing markstory/asset_compress (An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.)
cakephp/app suggests installing dereuromark/cakephp-ide-helper (After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan compatibility.)
cakephp/app suggests installing phpunit/phpunit (Allows automated tests to be run without system-wide install.)
cakephp/cakephp suggests installing lib-ICU (The intl PHP library, to use Text::transliterate() or Text::slug())
symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing symfony/lock ()
symfony/console suggests installing psr/log-implementation (For using the console logger)
m1/env suggests installing m1/vars (For loading of configs)
asm89/twig-cache-extension suggests installing psr/cache-implementation (To make use of PSR-6 cache implementation via PsrCacheAdapter.)
aptoma/twig-markdown suggests installing michelf/php-markdown (Original Markdown engine with MarkdownExtra.)
aptoma/twig-markdown suggests installing knplabs/github-api (Needed for using GitHub's Markdown engine provided through their API.)
ajgl/breakpoint-twig-extension suggests installing ext-xdebug (The Xdebug extension is required for the breakpoint to work)
ajgl/breakpoint-twig-extension suggests installing symfony/framework-bundle (The framework bundle to integrate the extension into Symfony)
ajgl/breakpoint-twig-extension suggests installing symfony/twig-bundle (The twig bundle to integrate the extension into Symfony)
psy/psysh suggests installing ext-pcntl (Enabling the PCNTL extension makes PsySH a lot happier :))
psy/psysh suggests installing ext-posix (If you have PCNTL, you'll want the POSIX extension as well.)
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.)
These are only suggestions that may extend the functionality of already installed packages, but everything should work fine without them. For example monolog/monolog will suggest a couple of plugins that will allow logging into different backends. But monolog/monolog will work without them - you may not be able to log for example to Sentry, but monolog will still be usable without this feature.
So usually you can just ignore these suggestions. But you can take a few minutes to check what these suggested packages are actually doing - you can learn about new technologies and solutions that can make your app better and easier to maintain.
If you're really not interested in these suggestions, you can use --no-suggest switch to avoid displaying them on install/update/require:
composer install --no-suggest

Adding Migration Package to CakePHP 3

I'm trying to add migration package to CakePHP 3.3 using the command
composer require cakephp/migration:~1.0
but I'm receiving the following result:
./composer.json has been updated
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
- The requested package cakephp/migration could not be found in any version, there may be a typo in the package name.
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.
Any suggestions to solve this?
As #ndm said its "migrations", also it should be allready installed by default if you created your app with composer or such. To activate it you just need to load it in the bootstrap.php as specified here Plugin::load('Migrations');

How to solve "Build:Unknown compiler option 'listemittedfiles'." on visual studio 2015 update 3?

After updating the NuGet Type Scripts packages, I was facing with one common build error problem "tsc.exe exited with code 1". After searching I have found the solution how to resolve it. As suggested I installed another two NuGet packages named Microsoft.TypeScript.Compiler and Microsoft.TypeScript.MSBuild. After installing those the tsc.exe exited with code 1 problem solved. But in the mean time a new problem arise on build "Unknown compiler option 'listemittedfiles'".
I was trying to solve it by the suggestion of this Typescript build failure.
But still there has no improvement of this problem.
Can anyone be able to provide a solution please? Please take a lots of thanks in advance.
My client project structure is looks like the image Please click here to view the image
I suggest you to try to fix this issue by installing TypeScript 2.0.6 using the following link:
Visual Studio 2015 TypeScript Tools (2.0.6 at the time of writing)
This will also point MSBuild to the proper TypeScript build, which fully supports the --listEmittedFiles command switch.
See also this answer and/or this blog article I wrote on this topic for further details and references about this issue.
I had the some problem. I found out, that I had a wrong (i.e. older) version of typescript installed (in addition to the current one) and even though the latest version was installed too, the old typescript compiler (tsc) was used.
Open a windows console and run the command following command:
tsc -v
The result should be:
Version 1.0.1.0
If you have the latest typescript installed but don't see the version above, you probably have older versions of typescript installed, that may be the cause of your problems. Uninstall the older versions via "Programs and features" in the control panel of windows.

configuration composer.json Symfony3 and sonataAdmin

I want to start a project with Symfony3 and SonataAdmin
I was trying a lot of versions of symfony and sonataAdminBundle
But I always get errors when updating composer
What's the correct composer.json to start my project
thanks
According to packagist the current v3.3.1 of SonataAdminBundle should be compatible with Symfony ^3.0.
You can just run composer require sonata-project/admin-bundle and it will automatically look for the newest compatible version. If that fails you could try allowing development-versions as well.
composer require sonata-project/admin-bundle:dev-master
That should be your last resort though as it pulls in an unstable dependency. Feel free to add composer's error to your question and maybe I or someone else can give a more precise answer.

Eclipse Juno 4.2 Google Plugin not installing: Cannot complete install because one or more required items could not be found

This is the error message I get:
Cannot complete the install because one or more required items could not be found.
Software being installed: Google App Engine Tools for Android 3.1.0.v201208080121-rel-r42 (com.google.gdt.eclipse.mobile.android.feature.feature.group 3.1.0.v201208080121-rel-r42)
I've tried numerous things including manually downloading the file from here and also I snooped around StackOverflow and I tried just moving all the plugins from the manual download into the plugins folder of my Eclipse. That didn't help me though because my perspective did not update with the plugins and I couldn't find the "Create New Web Application" option. I've also read some things about the XML file being wrong but I can't find it and those were for other Eclipse versions so I don't know if it applies to me.
I also tried excluding Google App Engine Tools for Android 3.1.0 but then it just says the next one in the list can't be found.
I'll be more than happy to provide anymore information. I am running Eclipse Juno 4.2 and Java 1.7 (I also have 1.6 installed though). I am using a Windows 7 PC. Thank you guys so much! I just want to code :[
I did not work for me with this URL: http://dl.google.com/eclipse/plugin/4.2
It worked with this one: http://dl.google.com/eclipse/plugin/3.8
I just changed 4.2 to 3.8.
I faced a similar problem I was downloading with 120 kb/s every time the download breaks down
when I moved to another place and downloaded the plugin with highest speed 400 kb/s It successfully downloaded and no problems found
You might think that issue is out of logic but that what I reached so far
Hope that Helps
I know this is a very old question but recently I found a solution to my problem so I am going to personally update the answer. For some reason, Eclipse Classic 4.2.2 Juno does not come with some of the required packages. After talking to some people, they recommended simply downloading Eclipse IDE for Java EE Developers which simply comes with most of the packages necessary. From there, it just worked!
My friend also mentioned you could try to manually download the packages on Eclipse Classic but that is far more of a hassle.
Hope this helps!

Resources