3 namespace Friendica\Test\Util;
6 * Trait to Mock Config settings
13 * Mocking a config setting
15 * @param string $family The family of the config double
16 * @param string $key The key of the config double
17 * @param mixed $value The value of the config double
18 * @param null|int $times How often the Config will get used
20 public function mockConfigGet($family, $key, $value, $times = null)
22 if (!isset($this->configMock)) {
23 $this->configMock = \Mockery::mock('alias:Friendica\Core\Config');
27 ->shouldReceive('get')
34 * Mocking setting a new config entry
36 * @param string $family The family of the config double
37 * @param string $key The key of the config double
38 * @param mixed $value The value of the config double
39 * @param null|int $times How often the Config will get used
40 * @param bool $return Return value of the set (default is true)
42 public function mockConfigSet($family, $key, $value, $times = null, $return = true)
44 if (!isset($this->configMock)) {
45 $this->configMock = \Mockery::mock('alias:Friendica\Core\Config');
48 $this->mockConfigGet($family, $key, false, 1);
50 $this->mockConfigGet($family, $key, $value, 1);
54 ->shouldReceive('set')
56 ->with($family, $key, $value)