laravel-mongodb icon indicating copy to clipboard operation
laravel-mongodb copied to clipboard

TypeError when runnig test with RefreshDatabase trait

Open spont4e opened this issue 9 months ago • 7 comments

  • Laravel-mongodb Version: 4.0.0-rc1
  • Laravel Version: 10.22.0 | 10.23.1
  • PHP Version: 8.1.17
  • Database Driver & Version: MongoDB driver for PHP
  • php8.1-mongodb
  • 1.15.0+1.11.1+1.9.2+1.7.5-1+0~20221209.37+debian11~1.gbp3b38f2

Description:

Eror when running test with RefreshDatabase trait

Steps to reproduce

  1. Setup Laravel 10.23.1
  2. Setup mongodb/laravel-mongodb:4.0.0-rc1
  3. Create new Feature test and use Illuminate\Foundation\Testing\RefreshDatabase::class trait in Test
  4. Run php artisan test

Expected behaviour

Continue without errors

Actual behaviour

TypeError: Illuminate\Database\DatabaseTransactionsManager::callbacksShouldIgnore(): Argument #1 ($transaction) must be of type Illuminate\Database\DatabaseTransactionRecord, null given, called in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php on line 102
Logs:
$ php artisan test

   PASS  Tests\Unit\ExampleTest
  ✓ it tests true is true                                                                                                                                                                                                      0.01s  

   FAIL  Tests\Feature\ExampleTest
  ⨯ it home page not found

   FAIL  Tests\Feature\ChatConfigurationControllerTest
  ⨯ it list chat configurations
  ⨯ it create chat configuration
  ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\ExampleTest > it home page not found                                                                                                                                                             TypeError   
  Illuminate\Database\DatabaseTransactionsManager::callbacksShouldIgnore(): Argument #1 ($transaction) must be of type Illuminate\Database\DatabaseTransactionRecord, null given, called in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php on line 102

  at vendor/laravel/framework/src/Illuminate/Database/DatabaseTransactionsManager.php:105
    101▕      *
    102▕      * @param  \Illuminate\Database\DatabaseTransactionRecord  $transaction
    103▕      * @return $this
    104▕      */
  ➜ 105▕     public function callbacksShouldIgnore(DatabaseTransactionRecord $transaction)
    106▕     {
    107▕         $this->callbacksShouldIgnore = $transaction;
    108▕ 
    109▕         return $this;


  ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\ChatConfigurationControllerTest > it list chat configurations                                                                                                                                 TypeError   
  Illuminate\Database\DatabaseTransactionsManager::callbacksShouldIgnore(): Argument #1 ($transaction) must be of type Illuminate\Database\DatabaseTransactionRecord, null given, called in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php on line 102

  at vendor/laravel/framework/src/Illuminate/Database/DatabaseTransactionsManager.php:105
    101▕      *
    102▕      * @param  \Illuminate\Database\DatabaseTransactionRecord  $transaction
    103▕      * @return $this
    104▕      */
  ➜ 105▕     public function callbacksShouldIgnore(DatabaseTransactionRecord $transaction)
    106▕     {
    107▕         $this->callbacksShouldIgnore = $transaction;
    108▕ 
    109▕         return $this;


  ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\ChatConfigurationControllerTest > it create chat configuration                                                                                                                                TypeError   
  Illuminate\Database\DatabaseTransactionsManager::callbacksShouldIgnore(): Argument #1 ($transaction) must be of type Illuminate\Database\DatabaseTransactionRecord, null given, called in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Testing/RefreshDatabase.php on line 102

  at vendor/laravel/framework/src/Illuminate/Database/DatabaseTransactionsManager.php:105
    101▕      *
    102▕      * @param  \Illuminate\Database\DatabaseTransactionRecord  $transaction
    103▕      * @return $this
    104▕      */
  ➜ 105▕     public function callbacksShouldIgnore(DatabaseTransactionRecord $transaction)
    106▕     {
    107▕         $this->callbacksShouldIgnore = $transaction;
    108▕ 
    109▕         return $this;



  Tests:    3 failed, 1 passed (1 assertions)
  Duration: 0.36s

spont4e avatar Sep 15 '23 08:09 spont4e