Skip to content
  • Eloy Lafuente's avatar
    MDL-67673 phpunit: Remove deprecated non-public attribute assertions · a293b3ae
    Eloy Lafuente authored
    With PHPUnit 8 a good number of assertions, all them related with
    operations on non-public attributes have been deprecated. And will
    be removed with PHPUnit 9.
    
    The main point is that unit tests shouldn't be testing non-public
    APIs (good practice) and those assertions were an error originally.
    
    See https://github.com/sebastianbergmann/phpunit/issues/3338 for
    the complete list and other details.
    
    When possible (the attributes being checked are public), the change
    is simple, just switching to normal assertions.
    
    When the attributes are not public we need to find a workaround
    to be able to test the same using public APIs, or use Reflection,
    or remove the tests.
    
    For the records, this is the regexp used to find all the cases:
    
    ag '>(assertAttribute|attribute\(|readAttributte|getStaticAttribute| \
        getObjectAttribute)' -G "test.php"
    a293b3ae