3

I am trying to perform a Unit test in my Phalcon app. I have setup the Unit test environment according to the tutorial provided.

What I am trying to do is to mock database adapter only for several functions. I want a mocked DB adapter, and when I call get method I want it to return a known dataset.

Thanks.

masterFly
  • 1,072
  • 12
  • 24

1 Answers1

0

I am finding unit testing with Phalcon overly difficult.

Not sure the following will answer your question but it seems 10months with out a response is a long time.

What I ended up doing was using mockery like so

$aclResultArray = ['role_name' => 'Pre Sale'];

    $aclMock = m::mock('overload:\Model\ModelFolder\ModelName');
    $aclMock->shouldReceive('findFirst')
        ->once()
        ->andReturn((object)$aclResultArray);

Hope this helps

MrsPop88
  • 303
  • 4
  • 14