Closed aleksandr-shevchenko closed 1 year ago
Your setUp()
method is called:
./vendor/bin/phpunit --no-output --log-events-text php://stdout
PHPUnit Started (PHPUnit 10.0.14 using PHP 8.2.3 (cli) on Linux)
Test Runner Configured
Bootstrap Finished (/tmp/test_phpunit/vendor/autoload.php)
Test Suite Loaded (4 tests)
Event Facade Sealed
Test Runner Started
Test Suite Sorted
Test Runner Execution Started (4 tests)
Test Suite Started (4 tests)
Test Suite Started (Project Test Suite, 4 tests)
Test Suite Started (Tests\SalaryCalculatorTest, 4 tests)
Before First Test Method Called (Tests\SalaryCalculatorTest::setUpBeforeClass)
setUpBeforeClass
Before First Test Method Finished:
- Tests\SalaryCalculatorTest::setUpBeforeClass
Test Suite Started (Tests\SalaryCalculatorTest::testCalculate, 4 tests)
Test Preparation Started (Tests\SalaryCalculatorTest::testCalculate#0)
Before Test Method Called (Tests\SalaryCalculatorTest::setUp)
Before Test Method Finished:
- Tests\SalaryCalculatorTest::setUp
Test Prepared (Tests\SalaryCalculatorTest::testCalculate#0)
Assertion Succeeded (Constraint: is equal to 9.0, Value: 9.0)
Test Passed (Tests\SalaryCalculatorTest::testCalculate#0)
tearDown
After Test Method Called (Tests\SalaryCalculatorTest::tearDown)
After Test Method Finished:
- Tests\SalaryCalculatorTest::tearDown
Test Finished (Tests\SalaryCalculatorTest::testCalculate#0)
Test Preparation Started (Tests\SalaryCalculatorTest::testCalculate#1)
Before Test Method Called (Tests\SalaryCalculatorTest::setUp)
Before Test Method Finished:
- Tests\SalaryCalculatorTest::setUp
Test Prepared (Tests\SalaryCalculatorTest::testCalculate#1)
Assertion Succeeded (Constraint: is equal to 10.8, Value: 10.8)
Test Passed (Tests\SalaryCalculatorTest::testCalculate#1)
tearDown
After Test Method Called (Tests\SalaryCalculatorTest::tearDown)
After Test Method Finished:
- Tests\SalaryCalculatorTest::tearDown
Test Finished (Tests\SalaryCalculatorTest::testCalculate#1)
Test Preparation Started (Tests\SalaryCalculatorTest::testCalculate#2)
Before Test Method Called (Tests\SalaryCalculatorTest::setUp)
Before Test Method Finished:
- Tests\SalaryCalculatorTest::setUp
Test Prepared (Tests\SalaryCalculatorTest::testCalculate#2)
Assertion Succeeded (Constraint: is equal to 18.0, Value: 18.0)
Test Passed (Tests\SalaryCalculatorTest::testCalculate#2)
tearDown
After Test Method Called (Tests\SalaryCalculatorTest::tearDown)
After Test Method Finished:
- Tests\SalaryCalculatorTest::tearDown
Test Finished (Tests\SalaryCalculatorTest::testCalculate#2)
Test Preparation Started (Tests\SalaryCalculatorTest::testCalculate#3)
Before Test Method Called (Tests\SalaryCalculatorTest::setUp)
Before Test Method Finished:
- Tests\SalaryCalculatorTest::setUp
Test Prepared (Tests\SalaryCalculatorTest::testCalculate#3)
Assertion Succeeded (Constraint: is equal to 11.25, Value: 11.25)
Test Passed (Tests\SalaryCalculatorTest::testCalculate#3)
tearDown
After Test Method Called (Tests\SalaryCalculatorTest::tearDown)
After Test Method Finished:
- Tests\SalaryCalculatorTest::tearDown
Test Finished (Tests\SalaryCalculatorTest::testCalculate#3)
Test Suite Finished (Tests\SalaryCalculatorTest::testCalculate, 4 tests)
tearDownAfterClass
After Last Test Method Called (Tests\SalaryCalculatorTest::tearDownAfterClass)
After Last Test Method Finished:
- Tests\SalaryCalculatorTest::tearDownAfterClass
Test Suite Finished (Tests\SalaryCalculatorTest, 4 tests)
Test Suite Finished (Project Test Suite, 4 tests)
Test Suite Finished (4 tests)
Test Runner Execution Finished
Test Runner Finished
PHPUnit Finished (Shell Exit Code: 0)
The output generated by echo
in setUp()
is simply swallowed.
In new version (10.0.16) PHPUnit start print 'echo' from setUp(), but why printed AFTER echo from tearDown() ?
PHPUnit 10.0.16 by Sebastian Bergmann and contributors.
Runtime: PHP 8.2.3
Configuration: D:\Rabota\PHP\_test\test_phpunit5\phpunit.xml
setUpBeforeClass
tearDown
setUp
.tearDown
setUp
.tearDown
setUp
.tearDown
setUp
. 4 / 4 (100%)tearDownAfterClass
Time: 00:00.018, Memory: 8.00 MB
OK (4 tests, 4 assertions)
Summary
Current behavior
setUp() not worked in PHPUnit 10.0.14
How to reproduce
Expected behavior
test_phpunit.zip