I want to install PHPUnit with composer and followed this tutorial: https://jtreminio.com/2013/03/unit-testing-tutorial-introduction-to-phpunit/
I added
{
"require-dev": {
"phpunit/phpunit": "3.7.14"
},
"autoload": {
psr-0": {
"phpUnitTutorial": ""
}
}
}
to the file composer.json
. Entering ./vendor/bin/phpunit
shows me that phpunit is installed.
This is my folder structure:
composer.json
composer.phar
phpUnitTutorial/
vendor/
I created a phpunit.xml
file inside the phpUnitTutorial
folder with the content
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./phpUnitTutorial/Test/</directory>
</testsuite>
</testsuites>
</phpunit>
Further I created an file at phpUnitTutorial/Test/StupidTest.php
with the content
<?php
namespace phpUnitTutorial\Test;
class StupidTest extends \PHPUnit_Framework_TestCase
{
public function testTrueIsTrue(){
$foo = ture;
$this->assertTrue($foo);
}
}
In the tutorial it is advised to do the following:
From project root, run PHPUnit: $ vendor/bin/phpunit
with the following screenshot:
If I execute $ vendor/bin/phpunit
inside the phpUnitTutorial
folder then I receive the error
bash: vendor/bin/phpunit: No such file or directory
which makes sense to me because the folder vendor
is on the same level as the folder phpUnitTutorial
. If I execute $ ../vendor/bin/phpunit
I get
It says no test executed and it doesn't confirm that my configuration file was read. Why is it not executing the test?