• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Register
  • Login
Bagisto Forum

Bagisto

  • Register
  • Login
  • Search
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups

Composer test does not work as expeceted

General Discussion
2
4
231
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    rabol last edited by 5 Sept 2022, 09:50

    Hi

    Composer test command does not work in a standard installation and there is no documentation stating how to set up the testing

    e.g
    composer test fails with this:

    set -e
    @php artisan migrate:fresh --env=testing

    Dropping all tables .................................................................................................................... 10ms FAIL

    In Connection.php line 759:

    SQLSTATE[HY000] [2002] Connection refused (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')

    In Exception.php line 18:

    SQLSTATE[HY000] [2002] Connection refused

    In PDOConnection.php line 40:

    SQLSTATE[HY000] [2002] Connection refused

    Normally testing uses SQlite not the same connection

    does one have to have a special .env or how can I make testing work ?

    Kind regards
    Steen

    1 Reply Last reply Reply Quote 0
    • sanjay-webkul
      sanjay-webkul last edited by 5 Sept 2022, 10:35

      @rabol said in Composer test does not work as expeceted:

      Connection refused

      Hi there,
      Please check your .env file, i guess you are not configure your databse credentials

      R 1 Reply Last reply 5 Sept 2022, 13:55 Reply Quote 0
      • R
        rabol @sanjay-webkul last edited by 5 Sept 2022, 13:55

        @sanjay-webkul but normally one does not need to create a connection.
        Test should run using a separate database

        https://laravel.com/docs/9.x/testing

        when you specify --env=testing there NEED to be a .env file named .env.testing

        Maybe a note in the documentation 🙂

        even with a .env.testing and using SQLite (Which I think is quite normal) it does not work

        1 Reply Last reply Reply Quote 0
        • sanjay-webkul
          sanjay-webkul last edited by 6 Sept 2022, 05:10

          Hi there,
          But the databse should be created which in mentioned on your .env.test file.

          1 Reply Last reply Reply Quote 0
          2 out of 4
          • First post
            2/4
            Last post