Database error: A Database Error Occurred

5 views
Skip to first unread message

Billy Patton

unread,
Apr 12, 2017, 7:45:12 AM4/12/17
to codeigniter
I am currently running PHP 7.1.2
Ci 3.06
PHPUnit 6.07
ci-phpuint-test 0.13.0
Database is : mysql  Ver 15.1 Distrib 10.1.21-MariaDB, for osx10.12 (x86_64) using readline 5.1

It is my task to test an application.
None of the models do any input validation.
When I pass in a null instead of an array. I get an error :
Database error: A Database Error Occurred

Error Number: 1048
Column 'address_type_id' cannot be null
...

The functions was expecting an array but does not verify that the input is non-null.
I've tried this to catch this error and continue :
    try {
      some_function(null);
    } catch(PHPUnit_Framework_ExpectationFailedException $e) {
      echo $e->getMessage();
    }

This does not catch the error.
The test dies.





Reply all
Reply to author
Forward
0 new messages