いくつかのミドルウェアを含むスリム アプリケーションがあります。
ルートの認証を実行し、次のようにルートを取得します。
$route = $this->getApplication()->router()->getCurrentRoute();
私は現在それをテストしており、Mockery を使用して連鎖呼び出しの結果をモックしようとしているので、ルートを効果的に指定できます。
$mock = M::mock('\Api\SessionMiddleware[getApplication]');
$mock->shouldReceive('router->getCurrentRoute')->andReturn('myRoute');
これはうまくいきません。: を呼び出そうとしrequire('lib/demeter/router.php')
ますが、これが存在しないため失敗します。
私も試しました:
$mock = M::mock('\Api\SessionMiddleware')->shouldDeferMissing();
$mock->shouldReceive('getApplication->router->getCurrentRoute')->andReturn('myRoute');
これも機能せず、次のように失敗します。
Failed opening required 'lib/demeter/getApplication.php'
私は何が欠けていますか?