Phpunit 3.7: what happened to the @assert annotation?

I have phpunit 3.7

The official announcement mentions some new annotations (and the reintroduction of an old, previously not recommended), but it doesn't mention the removal of @assert . In the list of changes for 3.7. , @assert does not appear on the page

When I run my code in a class using a code snippet

 <?php class MyMathClass { /** * Add two given values together and return sum * @assert (1,2) == 3 */ public function addValues($a,$b) { return $a+$b; } } 

output

 PHPUnit 3.7.1 by Sebastian Bergmann. Time: 1 second, Memory: 4.25Mb No tests executed! 

with php 3.6.2

  phpunit MyMathClass.php PHPUnit 3.6.12 by Sebastian Bergmann. . Time: 0 seconds, Memory: 2.75Mb OK (1 test, 1 assertion) 
+8
php phpunit
source share
1 answer

Answering my question by doing some research. And thanks to the commentators for being on the go.

There is no annotation because it was ported to the optional PHPUnit_SkeletonGenerator package.

There are two problems at this time:

  • remove @assert annotation from phpunit core core
  • documentation is not updated properly

The change log is inaccurate. He says (erroneously):

Deprecated --skeleton-class and -skeleton-test switches removed. functionality is now provided by the phpunit-skel command PHPUnit_SkeletonGenerator package.

Better to say it sounds something like this:

Deprecated --skeleton-class and -skeleton-test switches removed. functionality is now provided by the optional phpunit-skelgen PHPUnit_SkeletonGenerator package command. Therefore, the @assert annotation has been removed from the phpunit kernel. It becomes available after setting PHPUnit_SkeletonGenerator via PEAR.

Maybe I myself changed this through github and notified the attendants.

+5
source share

All Articles