Code Duplication    Length = 12-13 lines in 2 locations

packages/terms-of-service/tests/php/test_TermsOfService.php 1 location

@@ 85-96 (lines=12) @@
82
	 * @param mixed  $return_value  Return value of the function.
83
	 * @return phpmock\Mock The mock object.
84
	 */
85
	protected function mock_function( $function_name, $return_value = null, $called_with = null ) {
86
		$builder = new MockBuilder();
87
		$builder->setNamespace( __NAMESPACE__ )
88
				->setName( $function_name )
89
				->setFunction( function( $VALUE ) use ( &$return_value, $called_with ) {
90
					if ( $called_with ) {
91
						$this->assertEquals( $VALUE, $called_with );
92
					}
93
					return $return_value;
94
				} );
95
		return $builder->build()->enable();
96
	}
97
}
98

packages/config/tests/php/test_Textdomain_Customizer.php 1 location

@@ 93-105 (lines=13) @@
90
	 * @param mixed  $return_value  Return value of the function.
91
	 * @return phpmock\Mock The mock object.
92
	 */
93
	protected function mock_function( $function_name, $return_value = null ) {
94
		$builder = new MockBuilder();
95
		$builder->setNamespace( __NAMESPACE__ )
96
			->setName( $function_name )
97
			->setFunction(
98
				function() use ( &$return_value ) {
99
					return $return_value;
100
				}
101
			);
102
		$mock_function = $builder->build();
103
		$mock_function->enable();
104
		return $mock_function;
105
	}
106
}
107
108
//phpcs:disable Generic.Files.OneObjectStructurePerFile