Codeception / Codeception/AspectMock
How do I mock a protected property of a an object.
- 主要言語
- PHP
- スター
- 784
- フォーク
- 132
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Given
```
Class A {
protected $x = false;
public function methodA()
{
if($x){ return 'FOO'; }
return 'BAR';
}
}
```
My test is -
```
$a = new A();
\Aspectmock\Test::double($a,['x' => true]);
$this->assertEquals('BAR', $a->methodA() );
```
I get `null`.
How do I solve this?
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Reproduce the example using Class A, methodA(), and AspectMock\Test::double(), then inspect how the protected property lookup is handled. Compare the observed null result with the test's expected BAR value; done means the behavior is explained or corrected and covered by a regression test.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php
- 領域
- testing
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100