1
0
Fork 0

* method to gather if this session is 'interactive' or 'non interactive'

pull/410/head
till 2012-03-08 15:44:29 +01:00
parent d1482bfa3c
commit 3f665e8bbb
2 changed files with 28 additions and 0 deletions

View File

@ -242,6 +242,28 @@ class SvnDriver extends VcsDriver implements VcsDriverInterface
);
}
/**
* Determine if composer was called with --no-interaction/-n
* and return the option string for the command.
*
* @return string
* @uses parent::$io
* @see IOInterface::isInteractive()
*/
public function getSvnInteractiveSetting()
{
static $option;
if ($option !== null) {
return $option;
}
if ($this->io->isInteractive() === false) {
$option = '--non-interactive ';
} else {
$option = '';
}
return $option;
}
/**
* {@inheritDoc}
*/

View File

@ -44,4 +44,10 @@ class SvnDriverTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expect, $svn->getSvnCredentialString());
}
public function testInteractiveString()
{
$io = new \Composer\IO\NullIO; // non-interactive by design
$svn = new SvnDriver('http://svn.example.org', $io);
}
}