Add tests for InstanceManager and remove Decorator hook logic (avoid complex Dice logic)
This commit is contained in:
parent
527622df4a
commit
93af6f0564
14 changed files with 218 additions and 390 deletions
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace Friendica\Test\Util\Hooks\InstanceMocks;
|
||||
|
||||
class FakeInstance
|
||||
class FakeInstance implements IAmADecoratedInterface
|
||||
{
|
||||
protected $aText = null;
|
||||
protected $cBool = null;
|
||||
|
@ -39,6 +39,8 @@ class FakeInstance
|
|||
$this->aText = $aText;
|
||||
$this->cBool = $cBool;
|
||||
$this->bText = $bText;
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getAText(): ?string
|
||||
|
|
|
@ -25,14 +25,14 @@ class FakeInstanceDecorator implements IAmADecoratedInterface
|
|||
{
|
||||
public static $countInstance = 0;
|
||||
|
||||
const PREFIX = 'prefix1';
|
||||
|
||||
/** @var IAmADecoratedInterface */
|
||||
protected $orig;
|
||||
protected $prefix = '';
|
||||
|
||||
public function __construct(IAmADecoratedInterface $orig, string $prefix = '')
|
||||
public function __construct(IAmADecoratedInterface $orig)
|
||||
{
|
||||
$this->orig = $orig;
|
||||
$this->prefix = $prefix;
|
||||
|
||||
self::$countInstance++;
|
||||
}
|
||||
|
@ -44,16 +44,16 @@ class FakeInstanceDecorator implements IAmADecoratedInterface
|
|||
|
||||
public function getAText(): ?string
|
||||
{
|
||||
return $this->prefix . $this->orig->getAText();
|
||||
return static::PREFIX . $this->orig->getAText();
|
||||
}
|
||||
|
||||
public function getBText(): ?string
|
||||
{
|
||||
return $this->prefix . $this->orig->getBText();
|
||||
return static::PREFIX . $this->orig->getBText();
|
||||
}
|
||||
|
||||
public function getCBool(): ?bool
|
||||
{
|
||||
return $this->prefix . $this->orig->getCBool();
|
||||
return static::PREFIX . $this->orig->getCBool();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue