NullIOTest.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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\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. }