Unit testing with PHPUnit: Setting up PHPUnit (2/10)

preview_player
Показать описание

Official site

Twitter
Рекомендации по теме
Комментарии
Автор

<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="true"
verbose="true"
stopOnFailure="false">
<testsuites>
<testsuite name="Test suite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>

Asellusnat
Автор

Helpful hint for anyone (like me) who's new to Composer: 2:00 shows the "$composer dump-autoload" command. It's really quick here but it's a crucial step. From my understanding it's basically telling Composer, "Hey I just added a new class. You need to scan the project to find the new unit files and refresh your class list." I had too many "unit not found" failures, no fun. Also, a *security warning*: never run Composer with sudo (for Windows users, don't run as administrator). As popular as Composer is, it's still an outside library and may contain malware. For some people that's a no brainer, but everyone's gotta start somewhere.

frankzeppelin
Автор

For those who can't seem to get the configuration working: IT NEEDS TO BE IN THE SAME FOLDER AS THE PHPUNIT EXECUTABLE!!! otherwise it will just ignore it and list config options. You also need to slightly change the test folder path:
Man... this video was a nightmare lol. Getting over all the "composer" and "autoloading" and "configuration.xml" sure did take some toll on my mental health smh. Many things didn't work like in the video and I had to google all sorts of weird errors.

stepankylberger
Автор

"For those arriving here after updating phpunit to version 6 released on 2017-02-03 (e.g. with composer), you may be getting this error because phpunit code is now namespaced (check changelog). You will need to refactor things like \PHPUnit_Framework_TestCase to \PHPUnit\Framework\TestCase"

Manuel-nfje
Автор

hello..even after creating phpunit.xml, when i run the phpunit command i still get all the configurations listed and the one at @5:06

ManishKak
Автор

one important thing is that test script must be names you can put any name to replace but must have Test.php

spicytuna
Автор

No explanation for setting up without composer this time? :(

Zacki
Автор

since i didn't use composer to install, specifying autoload key and value shouldn't matter.

spicytuna
Автор

./vendor/bin/phpunit can't be inputted, not recognized...what can I do to fix this? I'm stuck at this part

cjwinsteria
Автор

I missed one step which is "how to install phpunit in MAMP ?"

almosawi
Автор

can this be done with procedural coding?

logicstv
Автор

I cant see anything on the screen.... i mean the text is so small.. i changed from TV to laptop etc but still the text is very small....some one that does tutorials for living should keep such detials in mind

bilaltariq
Автор

Error when I Input .\vendor\bin\phpunit after inserting the xml file




Could not load "C:\phpunit\phpunit.xml".

XML declaration allowed only at the start of the document

rfullo