/** * @param string $key * @param bool $force * @return null */ public function get($key, $force = false) { $result = null; if (!$force) { $result = $this->system->get($key); } if (null !== $result) { return $result; } $data = $this->normal->get($key); $this->system->set($key, $data); return $data; }
function it_always_calls_normal_when_true_flag_given(System $system, System $normal) { $system->get(self::DATA)->shouldNotBeCalled(); $normal->get(self::KEY)->willReturn(self::DATA); $system->set(self::KEY, self::DATA)->shouldBeCalled(); $this->get(self::KEY, true)->shouldReturn(self::DATA); }