Brain-WP/BrainMonkey

Mocks for deep arguments in the function doesn't work

wppunk opened this issue · 5 comments

expect( 'func_1' )
	->once()
	->with(
		[
			'arg1' => Mockery::type( 'string' ),
		]
	)
	->andReturn( true );

$this->assertTrue( func_1( [ 'arg1' => 'krya' ] ) );

Mockery::type( ... ) works only for first level of arguments.

Hi @wppunk

This is handled by Mockery, are you sure that is valid Mockery syntax?

@gmazzap Unfortunately, but it doesn't work in the Mockery

Sorry, you mean is not supported by Mockery?

In that case you should open a ticket for them. Or use validation via closure: http://docs.mockery.io/en/latest/reference/argument_validation.html#complex-argument-validation

@gmazzap Yep, I've created the issue

Thanks. So I'm closing this. In case they introduce that funcitonality, it will land on Brain Monkey automatically, since this just wrap that.