Tuleap Community Edition development and releases are no longer public. You have until September 30th to download packages and sources in Tuleap project. You can contact the team if you need further assistance.

    •  
      request #42633 Disallow usage of self::once() in tests
    Infos
    #42633
    Kevin Traini (ktraini)
    2025-11-18 22:02
    2025-04-16 11:39
    44381
    Details
    Disallow usage of self::once() in tests

    When using a PHPUnit mock, you can do this:

    $mock = $this->createMock(MyClass::class);
    $mock->expects(self::once())->method('myMethod');
    

    But method once is not static, you should use $this->once(). Same for other invocation count checker (never, exactly, atLeastOnce, ...)

    Add a PHPCS sniffer to check and fix

    Empty
    Empty
    Empty
    • [ ] enhancement
    • [x] internal improvement
    Empty
    Stage
    Kevin Traini (ktraini)
    Closed
    2025-04-16
    Attachments
    Empty
    References
    Referencing request #42633
    Referenced by request #42633

    Follow-ups