With PHPUnit Class 'mysqli' is not found

后端 未结 1 1134
不思量自难忘°
不思量自难忘° 2021-01-17 23:11

I just started with PHPUnit. Some simple tests I wrote are working. So in general PHPUnit is up and running. There\'s something wrong with the MySQLi class though.

I

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-17 23:20

    PHPUnit normally runs within the CLI - command line interface.

    The PHP you've got there is different than with the webserver. Different binary and often a different configuration as well.

    $ php -r "new mysqli();"
    

    Should give you the same error. Verify where the binary and configuration is located:

    $ which php
    

    And

    $ php -i | grep ini
    

    Ensure you've got the extension for the mysqli class installed and enabled. Once configured you should be able to run your unit-tests flawlessly.

    0 讨论(0)
提交回复
热议问题