Example #1
0
 /**
  * Verify that the get command returns null when none found.
  *
  * @test
  * @covers ::__construct
  * @covers ::get
  */
 public function getNoneFound()
 {
     $nullStrategy = $this->getMockBuilder('\\Nubs\\Sensible\\Strategy\\StrategyInterface')->setMethods(['get'])->getMock();
     $nullStrategy->expects($this->exactly(2))->method('get')->will($this->returnValue(null));
     $strategy = new ListStrategy([$nullStrategy, $nullStrategy]);
     $this->assertNull($strategy->get());
 }
Example #2
0
 /**
  * Initialize the editor strategy.
  *
  * @param string[] $editors The names to the potential editors.  The first
  *     command in the list that can be located will be used.
  * @param \Nubs\Which\Locator $commandLocator The command locator.  This
  *     helps locate commands using PATH.
  * @param \Habitat\Environment\Environment $environment The environment
  *     variable wrapper.  Defaults to null, which just uses the built-in
  *     getenv.
  */
 public function __construct(array $editors, CommandLocator $commandLocator, Environment $environment = null)
 {
     parent::__construct([new EnvironmentVariableStrategy('EDITOR', $environment), new CommandLocatorStrategy($editors, $commandLocator)]);
 }