PrefixOptionTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Predis\Configuration;
  11. use PHPUnit_Framework_TestCase as StandardTestCase;
  12. /**
  13. *
  14. */
  15. class PrefixOptionTest extends StandardTestCase
  16. {
  17. /**
  18. * @group disconnected
  19. */
  20. public function testDefaultOptionValue()
  21. {
  22. $option = new PrefixOption();
  23. $options = $this->getMock('Predis\Configuration\OptionsInterface');
  24. $this->assertNull($option->getDefault($options));
  25. }
  26. /**
  27. * @group disconnected
  28. */
  29. public function testAcceptsStringAndReturnsCommandProcessor()
  30. {
  31. $option = new PrefixOption();
  32. $options = $this->getMock('Predis\Configuration\OptionsInterface');
  33. $return = $option->filter($options, $value = 'prefix:');
  34. $this->assertInstanceOf('Predis\Command\Processor\CommandProcessorInterface', $return);
  35. $this->assertInstanceOf('Predis\Command\Processor\KeyPrefixProcessor', $return);
  36. $this->assertSame($value, $return->getPrefix());
  37. }
  38. }