예제 #1
0
 /**
  * @param array $params
  * @throws InvalidArgumentException
  * @throws TooFewArgumentsException
  */
 private function createCanvas(array $params)
 {
     if (count($params) < 2) {
         throw new TooFewArgumentsException();
     }
     if (!DrawingCommand::positiveNaturalArguments($params, 2)) {
         throw new InvalidArgumentException();
     }
     $this->canvas = new Canvas($params[0], $params[1]);
 }
 /**
  * @dataProvider argumentDataProvider
  */
 public function test_it_correctly_verifies_whether_arguments_are_positive_natural_numbers($args, $count, $expected)
 {
     $result = DrawingCommand::positiveNaturalArguments($args, $count);
     $this->assertEquals($expected, $result);
 }