| by dg | upgrading.md: the methods that now return never | | | |
| by dg | Environment::skip(), exit(), handleException() and TestCase::skip() return never | | | |
| by dg | added upgrading.md | | | |
| by dg | TestCase: data provider returning no data sets is an error A method-level data provider returning an empty array or an empty Traversable made runTest() return without calling the test method, and run() printed a passing mark. It now throws TestCaseException, the same way as an empty file-level data provider fails the test. | | | |
| by dg | TestCase: added #[Throws] and #[DataProvider] attributes as an alternative to annotations Method-level annotations only; attributes take precedence over the docblock, which stays fully functional. File-level .phpt annotations cannot be replaced (no file-level attributes in PHP, runner reads them statically before spawn). | | | |
| by dg | improved --cider mode (thx Claude) | | | |
| by dg | Assert: type 'integer' deprecated, use 'int' | | | |
| by dg | uses nette/phpstan-rules | | | |
| by dg | requires PHP 8.1 | | | |
| by dg | opened 2.7-dev | | | |
| by dg | Dumper: call arguments in stack traces are kept on a single line Arguments were formatted by toLine(), whose string encoding emits the actual character after the \n, \r and \t escapes and toggles bold around them, meant for assertion messages. In a stack trace this split frames over multiple lines and left the rest of the frame bold. Arguments now use a plain variant: strings are encoded as PHP literals, exceptions and Expect are shown as objects, without their possibly multiline message or dump. | | | |
| by dg | Runner: added warning when Xdebug slows down the run | | | |
| by dg | uses dresscode | | | |
| by dg | cs | | | |
| by dg | cs: grouped use statements | | | |
| by dg | cs: suppression comments | | | |
| by dg | cs: only compiler-optimized functions in use-function imports | | | |
| by dg | CI: coverage via pcov | | | |
| by dg | Released version 2.6.2 | | | |
| by dg | improved error messages, updated readme and agent documentation Changed messages: - "This test forgets to execute an assertion." is now "No assertions were executed in this test." - a test method with arguments but without a data provider reports "no data provider is configured" instead of "@dataProvider is missing" - an empty data provider file reports the data file, not the test file - DomQuery names the unsupported pseudo-class or combinator instead of "Not implemented." - Helpers::prepareTempDir() shows the given path instead of an empty one - fixed wording of CLI option errors ("does not accept an argument", "more than once") and a stray apostrophe - Assert::contains() and notContains() keep the custom description when the needle is not a string Assert::throws() declares the same type of $code as exception(). Expect lists all supported constraints. The readme example is runnable, lists all assertions and matches the current output and options. | | | |
| by dg | added support for PHP 8.6 Dumper: replaced spl_object_hash() with spl_object_id(), the former is deprecated. TestCase: ReflectionMethod::invoke() no longer receives an object for a static test method. Assert::type() maps the 'integer' alias to is_int(), because is_integer() is deprecated. FileMock.phpt: PHP 8.6 no longer shows the path in the warning about a failed stream_open(). | | | |
| by dg | HtmlGenerator: last line of a file without trailing newline has its line number The number of lines was the count of newlines plus one, and the code view listed the numbers up to that count exclusively, so the last line of a file not ending with a newline had no line number and coverage mark. The number of lines is now counted correctly, which also fixes the total shown in the report header. | | | |
| by dg | HtmlGenerator: report can be rendered repeatedly in one process The template declared a global function, so rendering a second report in the same process failed on its redeclaration. | | | |
| by dg | HtmlGenerator: file and directory names are escaped in the report Names were inserted into the page as HTML, so a path containing HTML special characters broke the report and could inject active content when opening a report generated from a foreign source tree. Directories in the tree view use generated element ids, as a path may contain characters like # that break the links. Not covered by a test, as the names are inserted by JavaScript of the report template. | | | |
| by dg | CliTester: coverage report does not pollute machine-readable output, failure to generate it is an error With -o tap, junit or none on stdout, the final "% covered" line was still printed into the TAP or XML output; the error about an empty coverage file goes to stderr in that case. When the requested report cannot be generated, tester now exits with code 1. | | | |
| by dg | CloverXMLGenerator: file and project metrics include functions and code outside classes Metrics of a file were the sum of its classes and traits only, so free functions and top-level statements were missing although their <line> elements were reported. Functions are now counted among methods, and the statements of a loaded file are all its executable lines. For a never loaded file the statements are still estimated from methods and functions. | | | |
| by dg | PhpParser: recognizes enums and functions returning by reference Methods of an enum were reported as free functions, and a function or method declared as function &name() was not reported at all. Enums are listed among classes, so they are included in Clover metrics. | | | |
| by dg | HtmlGenerator: file containing only dead code no longer causes division by zero Such a file has nothing left uncovered and is shown with 100 % coverage. | | | |
| by dg | Helpers: purge() refuses also paths resolving to a root directory The guard checked only the literal form of the path, so e.g. a path ending with '..' or a symbolic link pointing to the root passed. | | | |
| by dg | JUnitPrinter: failed tests are counted in the failures attribute Failed tests are reported as <failure> elements, but the summary counted them in the errors attribute and failures was missing. The testsuite element now has failures with their number and errors="0". Consumers reading only the errors attribute will see 0 now. | | | |
| by dg | JUnitPrinter: report is well-formed XML regardless of the test output A failure message comes from the output of the test process, and control characters or invalid UTF-8 in it made the whole report unparsable. They are now replaced by U+FFFD, in test names as well. | | | |
| by dg | TestHandler: invalid @multiple value is an error @multiple 0 or a non-numeric value ran the test twice, because the value was cast to int and used as range(0, $count - 1). It now fails with a message that a positive integer is expected. | | | |