class DiffOpTest

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Diff/Engine/DiffOpTest.php \Drupal\Tests\Component\Diff\Engine\DiffOpTest
  2. 8.9.x core/tests/Drupal/Tests/Component/Diff/Engine/DiffOpTest.php \Drupal\Tests\Component\Diff\Engine\DiffOpTest

Test DiffOp base class.

The only significant behavior here is that ::reverse() should throw an error if not overridden. In versions of this code in other projects, reverse() is marked as abstract, which enforces some of this behavior.

@coversDefaultClass \Drupal\Component\Diff\Engine\DiffOp

@group Diff @group legacy

Hierarchy

Expanded class hierarchy of DiffOpTest

File

core/tests/Drupal/Tests/Component/Diff/Engine/DiffOpTest.php, line 24

Namespace

Drupal\Tests\Component\Diff\Engine
View source
class DiffOpTest extends TestCase {
    use ExpectDeprecationTrait;
    use PhpUnitWarnings;
    
    /**
     * DiffOp::reverse() always throws an error.
     *
     * @covers ::reverse
     */
    public function testReverse() : void {
        $this->expectDeprecation('Drupal\\Component\\Diff\\Engine\\DiffOp::reverse() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. There is no replacement. See https://www.drupal.org/node/3337942');
        $this->expectError();
        $op = new DiffOp();
        $result = $op->reverse();
    }

}

Members

Title Sort descending Modifiers Object type Summary
DiffOpTest::testReverse public function DiffOp::reverse() always throws an error.
PhpUnitWarnings::$deprecationWarnings private static property Deprecation warnings from PHPUnit to raise with @trigger_error().
PhpUnitWarnings::addWarning public function Converts PHPUnit deprecation warnings to E_USER_DEPRECATED.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.