HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/local/wp/vendor/yoast/phpunit-polyfills/src/Polyfills/ExpectExceptionObject.php
<?php

namespace Yoast\PHPUnitPolyfills\Polyfills;

use Exception;

/**
 * Polyfill the TestCase::expectExceptionObject() method.
 *
 * Introduced in PHPUnit 6.4.0.
 *
 * @link https://github.com/sebastianbergmann/phpunit/pull/2780
 *
 * @since 0.1.0
 */
trait ExpectExceptionObject {

	/**
	 * Set expectations for an expected Exception based on an Exception object.
	 *
	 * @param Exception $exception Exception object.
	 *
	 * @return void
	 */
	final public function expectExceptionObject( Exception $exception ) {
		$this->expectException( \get_class( $exception ) );
		$this->expectExceptionMessage( $exception->getMessage() );
		$this->expectExceptionCode( $exception->getCode() );
	}
}