/**
  * @param array $input
  * @param array $validatorMessages
  * @param string $expectedMessage
  * @dataProvider executeDataProvider
  */
 public function testExecute(array $input, array $validatorMessages, $expectedMessage)
 {
     $return = isset($input['--ip']) ? $input['--ip'] !== ['none'] ? $input['--ip'] : [] : [];
     $this->maintenanceMode->expects($this->any())->method('getAddressInfo')->willReturn($return);
     $this->ipValidator->expects($this->once())->method('validateIps')->willReturn($validatorMessages);
     $tester = new CommandTester($this->command);
     $tester->execute($input);
     $this->assertEquals($expectedMessage, $tester->getDisplay());
 }
 /**
  * @param array $input
  * @param array $validatorMessages
  * @param string $expectedMessage
  * @dataProvider executeDataProvider
  */
 public function testExecute(array $input, array $validatorMessages, $expectedMessage)
 {
     if (isset($input['--none']) && !$input['--none'] && isset($input['ip'])) {
         $this->ipValidator->expects($this->once())->method('validateIps')->willReturn($validatorMessages);
         if (empty($validatorMessages) && !empty($input['ip'])) {
             $this->maintenanceMode->expects($this->once())->method('setAddresses')->with(implode(',', $input['ip']));
             $this->maintenanceMode->expects($this->once())->method('getAddressInfo')->willReturn($input['ip']);
         }
     } elseif (isset($input['--none']) && $input['--none']) {
         $this->ipValidator->expects($this->never())->method('validateIps')->willReturn($validatorMessages);
         $this->maintenanceMode->expects($this->once())->method('setAddresses')->with('');
     }
     $tester = new CommandTester($this->command);
     $tester->execute($input);
     $this->assertEquals($expectedMessage, $tester->getDisplay());
 }
 /**
  * @dataProvider validateIpsNoneNotAllowedDataProvider
  * @param string[] $ips
  * @param string[] $expectedMessages
  */
 public function testValidateIpsNoneNotAllowed($ips, $expectedMessages)
 {
     $this->assertEquals($expectedMessages, $this->ipValidator->validateIps($ips, false));
 }
 /**
  * Validates IP addresses and return error messages
  *
  * @param string[] $addresses
  * @return string[]
  */
 protected function validate(array $addresses)
 {
     return $this->ipValidator->validateIps($addresses, false);
 }