getMockBuilder('Predis\Configuration\OptionsInterface')->getMock(); $this->assertTrue($option->getDefault($options)); } /** * @group disconnected */ public function testAcceptsDifferentValuesAndFiltersThemAsBooleans(): void { $option = new Exceptions(); /** @var OptionsInterface */ $options = $this->getMockBuilder('Predis\Configuration\OptionsInterface')->getMock(); $this->assertFalse($option->filter($options, null)); $this->assertTrue($option->filter($options, true)); $this->assertFalse($option->filter($options, false)); $this->assertTrue($option->filter($options, 1)); $this->assertFalse($option->filter($options, 0)); $this->assertTrue($option->filter($options, 'true')); $this->assertFalse($option->filter($options, 'false')); $this->assertTrue($option->filter($options, 'on')); $this->assertFalse($option->filter($options, 'off')); } /** * @group disconnected */ public function testReturnsFalesOnValuesNotParsableAsBooleans(): void { $option = new Exceptions(); /** @var OptionsInterface */ $options = $this->getMockBuilder('Predis\Configuration\OptionsInterface')->getMock(); $this->assertFalse($option->filter($options, new stdClass())); $this->assertFalse($option->filter($options, 'invalid')); } }