Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Mocking classes #20

@EntonoX

Description

@EntonoX

For our authentication service i need to write some tests with phpunit. I'm using Lumen framework and having problems to mock classes.

What i'm trying;

$kongHttpClient = Mockery::mock(\DouglasDC3\Kong\Http\HttpClient::class);

$kongHttpClient->shouldReceive('get')->once()->andReturn(json_encode([]));

$this->app->instance(\DouglasDC3\Kong\Http\HttpClient::class, $kongHttpClient);

This way i'm trying to mock a Kong reply, so i can test my user creation / JWT generation to the point that Kong endpoints are called.

But is seems this mock isnt'getting called at all. Any other ideas on how to try to mock?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions