1
私はCakePHP 3コンポーネントを模擬しようとしています。CakePHP 3コンポーネントを模擬しようとしたときにエラーが発生しました
私はこれを試してみました:
$authComponent = $this->getMockBuilder(App\Controller\Component\AuthorizationComponent::class)
->getMock();
$authComponent
->method('isAuthorized')
->willReturn($this->returnValue(true));
テストを実行している場合しかし、それは言う:
Trying to configure method "isAuthorized" which cannot be configured because it does not exist, has not been specified, is final, or is static
は、おそらく私が間違ってモックを作成しました。それを正しく行う方法を教えてもらえますか?
あなたのコンポーネントがどのように見えるんか? – jeremyharris