NullIOTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Test\IO;
  12. use Composer\IO\NullIO;
  13. use Composer\Test\TestCase;
  14. class NullIOTest extends TestCase
  15. {
  16. public function testIsInteractive()
  17. {
  18. $io = new NullIO();
  19. $this->assertFalse($io->isInteractive());
  20. }
  21. public function testhasAuthentication()
  22. {
  23. $io = new NullIO();
  24. $this->assertFalse($io->hasAuthentication('foo'));
  25. }
  26. public function testAskAndHideAnswer()
  27. {
  28. $io = new NullIO();
  29. $this->assertNull($io->askAndHideAnswer('foo'));
  30. }
  31. public function testgetAuthentications()
  32. {
  33. $io = new NullIO();
  34. $this->assertInternalType('array', $io->getAuthentications());
  35. $this->assertEmpty($io->getAuthentications());
  36. $this->assertEquals(array('username' => null, 'password' => null), $io->getAuthentication('foo'));
  37. }
  38. public function testAsk()
  39. {
  40. $io = new NullIO();
  41. $this->assertEquals('foo', $io->ask('bar', 'foo'));
  42. }
  43. public function testAskConfirmation()
  44. {
  45. $io = new NullIO();
  46. $this->assertEquals('foo', $io->askConfirmation('bar', 'foo'));
  47. }
  48. public function testAskAndValidate()
  49. {
  50. $io = new NullIO();
  51. $this->assertEquals('foo', $io->askAndValidate('question', 'validator', false, 'foo'));
  52. }
  53. public function testSelect()
  54. {
  55. $io = new NullIO();
  56. $this->assertEquals('1', $io->select('question', array('item1', 'item2'), '1', 2, 'foo', true));
  57. }
  58. }