once() ->with(UUID_TYPE_RANDOM) ->andReturn($this->uuidString); PHPMockery::mock('Ramsey\Uuid\Generator', 'uuid_parse') ->once() ->with($this->uuidString) ->andReturn($this->uuidBinary); $generator = new PeclUuidRandomGenerator(); $uuid = $generator->generate($this->length); $this->assertSame($this->uuidBinary, $uuid); } }