tests/SortTest.php
/**
     * A test if the Api returns a error if the input is not numerical or array.
     *
     * @return void
     */
A test if the Api returns a error if the input is not numerical or array.
@return void
A test if the Api returns a error if the input is not numerical or array . @return void
public function testErrorIfInputIsInvalid()
    {
        $this->post('/sort/api/v1/bubble', ['input' => ['a',1,2,'b']]);
        $this->receiveJson(['input' => ['a',1,2,'b'],
            'errors' =>
                [['field' => 'input.0',
                'message' => 'The input.0 must be a number.'],
                ['field' => 'input.3',
                'message' => 'The input.3 must be a number.']]]);
        $this->post('/sort/api/v1/bubble', ['input' => 'a']);
        $this->receiveJson(['input' => 'a',
            'errors' =>
                [['field' => 'input', 'message' => 'The input must be an array.']]]);
    }
public function testErrorIfInputIsInvalid ( ) { $ this -> post ( '/sort/api/v1/bubble' , [ 'input' => [ 'a' , 1 , 2 , 'b' ] ] ) ; $ this -> receiveJson ( [ 'input' => [ 'a' , 1 , 2 , 'b' ] , 'errors' => [ [ 'field' => 'input.0' , 'message' => 'The input.0 must be a number.' ] , [ 'field' => 'input.3' , 'message' => 'The input.3 must be a number.' ] ] ] ) ; $ this -> post ( '/sort/api/v1/bubble' , [ 'input' => 'a' ] ) ; $ this -> receiveJson ( [ 'input' => 'a' , 'errors' => [ [ 'field' => 'input' , 'message' => 'The input must be an array.' ] ] ] ) ; }
A test if the Api returns a error if the input is not numerical or array.
A test if the Api returns a error if the input is not numerical or array .