B
B
BBQ4YOU2019-08-05 12:17:04
PHPUnit
BBQ4YOU, 2019-08-05 12:17:04

Why doesn't PHPunit see tests?

Bitrix has the following structure

- ...
- local
  - tests
    - unit
      - BitrixTestCase.php
    - bootstrap.php
    - phpunit.xml.dist
   - vendor
     - ...

phpunit.xml.dist:
<phpunit
        bootstrap="bootstrap.php"
        colors="true">
    <testsuites>
        <testsuite name="Test">
            <directory>./unit</directory>
        </testsuite>
    </testsuites>
</phpunit>

I run the whole thing from the directory with the following command vendor/bin/phpunit.bat --configuration tests/phpunit.xml.dist , to which I get the answer: No tests executed!
If you explicitly set a file with tests in xml: then the tests run successfully, but how can you force it to take tests from the necessary directory?
<file>./unit/BitrixTestCase.php</file>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Ukolov, 2019-08-05
@BBQ4YOU

PhpUnit looks for files with the Test.php suffix by default. Your file has the TestCase.php suffix - such classes should not contain tests at all, the auxiliary code is usually there.

K
Kirill Gorelov, 2019-08-05
@Kirill-Gorelov

I am confused by this
phpunit.xnl.dist and phpunit.xml.dist
Two different names

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question