Yii2: install codeception and phpunit with composer and use it - testing

System: Win7 ,64Bit
I installed yii2 with composer. And I also tried to install codeception and phpunit by composer using these commands
composer global require "phpunit/phpunit=4.3.*"
composer global require "codeception/codeception=2.0.*"
composer global require "codeception/specify=*"
composer global require "codeception/verify=*"
I also added teh phpunit to the composer.json
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*",
"phpunit/phpunit": "4.3.*"
},
and added current Path to the PATH environment variable
E:\wamp\www\website\vendor\bin
But if I run
phpunit --version
or
codeception
I get the Error message "The command 'phpunit' wasn't found...

I am sure that E:\wamp\www\website\vendor\bin does not contain any phpunit or codeception files. Because you have installed phpunit and codeception globally, it means that they are installed someplace else and not in the website files (and that makes sense too).
Here are some instructions on how to add composer globally in Windows
Is there any way to install Composer globally on Windows?.
I do not have windows so I cannot tell you directly where things are.

Related

How to install simple plain Javascript autocompletion in NeoVIM using yarn?

So I want to install JavaScript support as I have already installed coc.nvim plug-in and node.js, but the nvim says the following:
So I do the following:
I create .config/nvim/plugged/coc.nvim (Because plugged folder was not created)
Inside coc.nvim I type: sudo npm install -g yarn
yarn install
yarn build
Now, It says: error Couldn't find a package.json file in "/home/dru7/.config/nvim/plugged/coc.nvim"
So I type yarn add javascript - PACKAGE NO LONGER SUPPORTED
7)I can delete everything inside coc.nvim and I want to install correct dependency, how?
So how do I add simple autocompletion ( for Javascript into an empty coc.nvim file?

Opis\Closure\SerializableClosure - Error afer PHP 8.1 Update

I have updated my system to PHP 8.1 (XAMPP).
Now I have the problem that when I enter the command "php artisan serve" I get the following error message:
Opis\Closure\SerializableClosure implements the Serializable interface, which is deprecated.
Implement __serialize() and __unserialize() instead
(or in addition, if support for old PHP versions is necessary).
Can you help me what I can do to make it work again?
You need to update laravel dependencies. Simply go to your project root directory and use composer to update dependencies using command prompt.
Command should be:
composer update
composer upgrade laravel/framework --with-all-dependencies
You would need to update laravel/framework with it's dependencies. Instead of running composer upgrade which upgrades all packages, you could just run composer upgrade laravel/framework --with-all-dependencies, shorthand is -W.
From the composer command help -W Update also dependencies of packages in the argument list, including those which are root requirements.
Just delete composer.lock.json, with me resolve and after run composer install

Local versus global packages for Angular development

When developing with Angular, one can
npm install
to install packages locally, or
npm install -g
to install them globally. I am wondering what are the implications of each practice. And what happens if a particular package is installed both ways, perhaps with different versions? Which one will my Angular app use?
From there https://www.quora.com/When-do-I-install-a-package-locally-or-globally-in-NPM
In general, the rule of thumb is:
1. If you’re installing something that you want to use in your program, using
import { 'whatever'}, then install it locally, at the root of your project.
2. If you’re installing something that you want to use in your shell, on the command line or something, install it globally, so that its binaries end up in your PATH environment variable.

Install extension in Yii2

Hi can someone show me steps how can I install fabric.js in yii2 project? This is Fabric.js: link to github
There I can see that I can install fabric.js only by bower or npm. I don know that i have bower on start in Yii2 procejct or I should I install this bower. Now I only used composer install and update. And I dont know how to install this in my project. Maybe anyone can show me easiest way to install this by composer only or other easy way? I tried to write command :
bower install fabric
but i have error:
bash: bower: command not found
Make sure you have got Composer asset plugin installed. If not run console command:
composer global require "fxp/composer-asset-plugin:^1.2.0"
All you have to do now is to add in require section of composer.json
"bower-asset/fabric": "*"
and run composer update command in console (in the project folder).

No response from codeception

I am trying to run codeception against my Yii2 project. However, I can getting no response from the simplest command line invocations. The command just sits there, for hours, until I break it.
I have installed this codeception manually, using the official phar and placing it in my path. I also have a copy in my vendors directory. Both of them do no work.
#install
wget http://codeception.com/codecept.phar
cp codecept.phar /usr/local/bin/codecep
#any combination hangs
/usr/local/bin/codecep bootstrap
vendor/bin/codecept build
codecept run
codecept
In am running PHP 5.5, and installed the latest version of codeception from the project web site.
Can not speak for your specific installation of Yii2 (basic/advanced/custom/etc) but this works for myself and my team:
In composer.json of your project ensure the following lines exist:
"require-dev": {
"yiisoft/yii2-debug": "^2.0.0",
"yiisoft/yii2-gii": "^2.0.0",
"yiisoft/yii2-codeception": "^2.0.0",
"yiisoft/yii2-faker": "^2.0.0",
"codeception/codeception": "2.2",
"codeception/specify": "^0.4.3",
"codeception/verify": "^0.3.0"
}
In a CLI client (terminal/cmd/putty) run php composer install from the root of the project and ensure the packages install. Next check inside the ./vendor/bin dir in your project, do you see a file named 'codecept'? You should.
Next, check that ./tests directory exists; again at the root of your project. Inside that should be a file called codeception.yml This is the main configuration file codeception uses the begin the testing process(es). Without it nothing works.
Back in the CLI client run php ./vendor/bin/codecept run -c ./tests/codeception.yml. In the worse case this should provide some output from Codeception.
Try: www.pceuropa.net/blog/yii2-tests-codeception-configuration-first-test/