summaryrefslogtreecommitdiffstatshomepage
path: root/tests/phpunit/includes/factory/class-wp-unittest-factory-callback-after-create.php
blob: 115c950c2f27eabbc5cbe8e653e3a19f36f5ef16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

class WP_UnitTest_Factory_Callback_After_Create {

	/**
	 * @var callable
	 */
	public $callback;

	/**
	 * WP_UnitTest_Factory_Callback_After_Create constructor.
	 *
	 * @since UT (3.7.0)
	 *
	 * @param callable $callback A callback function.
	 */
	public function __construct( $callback ) {
		$this->callback = $callback;
	}

	/**
	 * Calls the set callback on a given object.
	 *
	 * @since UT (3.7.0)
	 *
	 * @param int $object_id ID of the object to apply the callback on.
	 *
	 * @return mixed Updated object field.
	 */
	public function call( $object_id ) {
		return call_user_func( $this->callback, $object_id );
	}
}