unit traduccion test golang app php symfony mocking phpunit mockery

php - traduccion - Burla que especifica los argumentos esperados para mĂșltiples llamadas



php unit symfony (1)

Bueno, eso fue rápido; aparentemente, P se puede hacer esto y funciona muy bien:

$this->eventDispatcher ->shouldReceive(''dispatch'') ->with(Events::SELECT,/Mockery::type(''/Not/Really/A/Namespace/Event'')); $this->eventDispatcher ->shouldReceive(''dispatch'') ->with(Events::ACTIVITY,/Mockery::type(''/Not/Really/A/Namespace/Event'');

Estoy tratando de burlarme de un objeto que recibe dos llamadas a la misma función pero con diferentes argumentos. Es bastante sencillo devolver diferentes valores de retorno para llamadas múltiples, pero no encuentro en ningún lado cómo hacerlo con la validación del argumento.

Lo intenté:

$this->eventDispatcher ->shouldReceive(''dispatch'') ->twice() ->with(Events::SELECT,/Mockery::type(''/Not/Really/A/Namespace/Event'')) ->with(Events::ACTIVITY,/Mockery::type(''/Not/Really/A/Namespace/Event'');

Y

$this->eventDispatcher ->shouldReceive(''dispatch'') ->twice() ->with( [Events::SELECT,/Mockery::type(''/Not/Really/A/Namespace/Event'')], [Events::ACTIVITY,/Mockery::type(''/Not/Really/A/Namespace/Event'')] );

Pero no funcionan.

Desde la salida que PHPUnit me da, parece que estoy obteniendo una matriz.