12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace Predis\Configuration;
- use stdClass;
- use PredisTestCase;
- class ExceptionsOptionTest extends PredisTestCase
- {
-
- public function testDefaultOptionValue()
- {
- $option = new ExceptionsOption();
- $options = $this->getMock('Predis\Configuration\OptionsInterface');
- $this->assertTrue($option->getDefault($options));
- }
-
- public function testAcceptsDifferentValuesAndFiltersThemAsBooleans()
- {
- $option = new ExceptionsOption();
- $options = $this->getMock('Predis\Configuration\OptionsInterface');
- $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'));
- }
-
- public function testReturnsFalesOnValuesNotParsableAsBooleans()
- {
- $option = new ExceptionsOption();
- $options = $this->getMock('Predis\Configuration\OptionsInterface');
- $this->assertFalse($option->filter($options, new stdClass));
- $this->assertFalse($option->filter($options, 'invalid'));
- }
- }
|