3 namespace Friendica\Test\Util;
5 use Mockery\MockInterface;
8 * Trait to Mock Config settings
13 * @var MockInterface The mocking interface of Friendica\Core\Config
18 * Mocking a config setting
20 * @param string $family The family of the config double
21 * @param string $key The key of the config double
22 * @param mixed $value The value of the config double
23 * @param null|int $times How often the Config will get used
25 public function mockConfigGet($family, $key, $value, $times = null)
27 if (!isset($this->configMock)) {
28 $this->configMock = \Mockery::mock('alias:Friendica\Core\Config');
32 ->shouldReceive('get')
39 * Mocking setting a new config entry
41 * @param string $family The family of the config double
42 * @param string $key The key of the config double
43 * @param mixed $value The value of the config double
44 * @param null|int $times How often the Config will get used
45 * @param bool $return Return value of the set (default is true)
47 public function mockConfigSet($family, $key, $value, $times = null, $return = true)
49 if (!isset($this->configMock)) {
50 $this->configMock = \Mockery::mock('alias:Friendica\Core\Config');
53 $this->mockConfigGet($family, $key, false, 1);
55 $this->mockConfigGet($family, $key, $value, 1);
59 ->shouldReceive('set')
61 ->with($family, $key, $value)