Instalar o phpunit (precisei apagar um pouco):
PS F:\Pedro\Github\php\Semana8-1> composer require --dev phpunit/phpunit ^10
The "10" constraint for "phpunit/phpunit" appears too strict and will likely not match what you want. See https://getcomposer.org/constraints
./composer.json has been updated
Running composer update phpunit/phpunit
Loading composer repositories with package information
Updating dependencies
Lock file operations: 26 installs, 0 updates, 0 removals
- Locking myclabs/deep-copy (1.11.1) - Locking nikic/php-parser (v4.17.1) - Locking phar-io/manifest (2.0.3) - Locking phar-io/version (3.2.1) - Locking phpunit/php-code-coverage (10.1.7) - Locking phpunit/php-file-iterator (4.1.0) - Locking phpunit/php-invoker (4.0.0) - Locking phpunit/php-text-template (3.0.1) - Locking phpunit/php-timer (6.0.0) - Locking phpunit/phpunit (10.0.0) - Locking sebastian/cli-parser (2.0.0) - Locking sebastian/code-unit (2.0.0) - Locking sebastian/code-unit-reverse-lookup (3.0.0) - Locking sebastian/comparator (5.0.1) - Locking sebastian/complexity (3.1.0) - Locking sebastian/diff (5.0.3) - Locking sebastian/environment (6.0.1) - Locking sebastian/exporter (5.1.1) - Locking sebastian/global-state (6.0.1) - Locking sebastian/lines-of-code (2.0.1) - Locking sebastian/object-enumerator (5.0.0) - Locking sebastian/object-reflector (3.0.0) - Locking sebastian/recursion-context (5.0.0) - Locking sebastian/type (4.0.0) - Locking sebastian/version (4.0.1) - Locking theseer/tokenizer (1.2.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 26 installs, 0 updates, 0 removals
5 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
23 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
PS F:\Pedro\Github\php\Semana8-1> vendor\bin\phpunit --version
PHPUnit 10.0.0 by Sebastian Bergmann and contributors.
Não consigo fazer teste (tentei como Tests e tests):
PS F:\Pedro\Github\php\Semana8-1> vendor\bin\phpunit tests
Test file "tests" not found
PHP:
<?php
namespace Alura\Leilao\Tests\Service;
use Alura\Leilao\Model\Lance;
use Alura\Leilao\Model\Leilao;
use Alura\Leilao\Model\Usuario;
use Alura\Leilao\Service\Avaliador;
use PHPUnit\Framework\TestCase;
class AvaliadorTest extends TestCase
{ public function testUm()
{ $leilao = new Leilao('Fiat 147 0KM');
$maria = new Usuario('Maria');
$joao = new Usuario('Joao');
$leilao->recebeLance(new Lance($joao,2000));
$leilao->recebeLance(new Lance($maria,2500));
$leiloeiro = new Avaliador();
$leiloeiro->avalia($leilao)
;$maiorValor = $leiloeiro->getMaioValor();
self::assertEquals(2500,$maiorValor);}}