Xdebug: [Step Debug] Could not connect to debugging client. Tried: 127.0.0.1:9003 (through xdebug.client_host/xdebug.client_port).

Xdebug: [Step Debug] Could not connect to debugging client. Tried: 127.0.0.1:9003 (through xdebug.client_host/xdebug.client_port).

   PASS  Tests\Unit\Models\WhatsappGroupLinkTest
  ✓ model metadata is converted                                          0.01s  
  ✓ model class loads

   PASS  Tests\Unit\Models\WhatsappGroupMembershipTest
  ✓ model metadata is converted                                          0.01s  
  ✓ model class loads

   PASS  Tests\Unit\Models\WhatsappInviteLogTest
  ✓ model metadata is converted
  ✓ model class loads


   FAIL  Tests\Unit\Services\Whatsapp\WhatsappContactServiceTest
  ⨯ list parent contacts returns primary and second                      0.40s  



   PASS  Tests\Unit\Services\Whatsapp\WhatsappContextServiceTest
  ✓ school year aliases generate expected values                         0.28s  
  ✓ has roster for year                                                  0.28s  



   FAIL  Tests\Unit\Services\Whatsapp\WhatsappInviteBundleServiceTest
  ⨯ bundle for parent returns links and emails                           0.28s  
  ✓ consolidate bundles merges by parent                                 0.28s  



   PASS  Tests\Unit\Services\Whatsapp\WhatsappInviteNotificationServiceTest
  ✓ dispatch returns error when no listeners                             0.29s  
  ✓ dispatch triggers event when listener registered                     0.28s  


   FAIL  Tests\Unit\Services\Whatsapp\WhatsappInviteServiceTest
  ⨯ send returns success for parent mode                                 0.28s  



   PASS  Tests\Unit\Services\Whatsapp\WhatsappLinkServiceTest
  ✓ upsert creates link                                                  0.28s  
  ✓ paginate filters by active                                           0.28s  



   PASS  Tests\Unit\Services\Whatsapp\WhatsappMembershipServiceTest
  ✓ update membership saves primary                                      0.29s  
  ✓ update membership returns error when table missing                   0.29s  







   FAIL  Tests\Feature\Api\V1\Whatsapp\WhatsappInviteControllerTest
  ⨯ parent contacts endpoint returns contacts                            0.31s  
  ⨯ parent contacts by class endpoint returns sections                   0.29s  
  ⨯ send invites returns success when listener registered                0.29s  
  ⨯ send invites returns error when no listener                          0.29s  
  ⨯ membership update saves record                                       0.29s  
  ✓ send invites validation rejects payload                              0.31s  








   FAIL  Tests\Feature\Api\V1\Whatsapp\WhatsappLinkControllerTest
  ✓ index returns paginated links                                        0.30s  
  ✓ show returns single link                                             0.30s  
  ⨯ store creates link                                                   0.29s  
  ⨯ update updates link                                                  0.29s  
  ✓ destroy deletes link                                                 0.31s  
  ✓ store validation rejects invalid payload                             0.30s  
  ✓ requires authentication                                              0.29s  
  ────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Unit\Services\Whatsapp\WhatsappContactServi…  QueryException   
  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: parents.secondparent_id (Connection: sqlite, Database: :memory:, SQL: insert into "parents" ("secondparent_firstname", "secondparent_lastname", "secondparent_email", "secondparent_phone", "firstparent_id", "school_year", "semester", "created_at", "updated_at") values (Parent, Two, parent2@example.com, 5555555555, 10, 2025-2026, Fall, 2026-03-10 20:29:52, 2026-03-10 20:29:52))

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
    834▕             $exceptionType = $this->isUniqueConstraintError($e)
    835▕                 ? UniqueConstraintViolationException::class
    836▕                 : QueryException::class;
    837▕ 
  ➜ 838▕             throw new $exceptionType(
    839▕                 $this->getNameWithReadWriteType(),
    840▕                 $query,
    841▕                 $this->prepareBindings($bindings),
    842▕                 $e,

      [2m+8 vendor frames [22m
  9   tests/Unit/Services/Whatsapp/WhatsappContactServiceTest.php:38

  ────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Unit\Services\Whatsapp\WhatsappInviteBundle…  QueryException   
  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: parents.secondparent_id (Connection: sqlite, Database: :memory:, SQL: insert into "parents" ("secondparent_firstname", "secondparent_lastname", "secondparent_email", "secondparent_phone", "firstparent_id", "school_year", "semester", "created_at", "updated_at") values (Parent, Two, parent2@example.com, 5555555555, 10, 2025-2026, Fall, 2026-03-10 20:29:53, 2026-03-10 20:29:53))

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
    834▕             $exceptionType = $this->isUniqueConstraintError($e)
    835▕                 ? UniqueConstraintViolationException::class
    836▕                 : QueryException::class;
    837▕ 
  ➜ 838▕             throw new $exceptionType(
    839▕                 $this->getNameWithReadWriteType(),
    840▕                 $query,
    841▕                 $this->prepareBindings($bindings),
    842▕                 $e,

      [2m+8 vendor frames [22m
  9   tests/Unit/Services/Whatsapp/WhatsappInviteBundleServiceTest.php:37

  ────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Unit\Services\Whatsapp\WhatsappInviteServic…  QueryException   
  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: parents.secondparent_id (Connection: sqlite, Database: :memory:, SQL: insert into "parents" ("secondparent_firstname", "secondparent_lastname", "secondparent_email", "secondparent_phone", "firstparent_id", "school_year", "semester", "created_at", "updated_at") values (Parent, Two, parent2@example.com, 5555555555, 10, 2025-2026, Fall, 2026-03-10 20:29:54, 2026-03-10 20:29:54))

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
    834▕             $exceptionType = $this->isUniqueConstraintError($e)
    835▕                 ? UniqueConstraintViolationException::class
    836▕                 : QueryException::class;
    837▕ 
  ➜ 838▕             throw new $exceptionType(
    839▕                 $this->getNameWithReadWriteType(),
    840▕                 $query,
    841▕                 $this->prepareBindings($bindings),
    842▕                 $e,

      [2m+8 vendor frames [22m
  9   tests/Unit/Services/Whatsapp/WhatsappInviteServiceTest.php:65
  10  tests/Unit/Services/Whatsapp/WhatsappInviteServiceTest.php:21

  ────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\Api\V1\Whatsapp\WhatsappInviteContr…  QueryException   
  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: parents.secondparent_id (Connection: sqlite, Database: :memory:, SQL: insert into "parents" ("secondparent_firstname", "secondparent_lastname", "secondparent_email", "secondparent_phone", "firstparent_id", "school_year", "semester", "created_at", "updated_at") values (Parent, Two, parent2@example.com, 5555555555, 10, 2025-2026, Fall, 2026-03-10 20:29:56, 2026-03-10 20:29:56))

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
    834▕             $exceptionType = $this->isUniqueConstraintError($e)
    835▕                 ? UniqueConstraintViolationException::class
    836▕                 : QueryException::class;
    837▕ 
  ➜ 838▕             throw new $exceptionType(
    839▕                 $this->getNameWithReadWriteType(),
    840▕                 $query,
    841▕                 $this->prepareBindings($bindings),
    842▕                 $e,

      [2m+8 vendor frames [22m
  9   tests/Feature/Api/V1/Whatsapp/WhatsappInviteControllerTest.php:22

  ────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\Api\V1\Whatsapp\WhatsappInviteContr…  QueryException   
  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: classSection.semester (Connection: sqlite, Database: :memory:, SQL: insert into "classSection" ("class_section_id", "class_section_name", "class_id", "created_at", "updated_at") values (200, Grade 1, 1, 2026-03-10 20:29:56, 2026-03-10 20:29:56))

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
    834▕             $exceptionType = $this->isUniqueConstraintError($e)
    835▕                 ? UniqueConstraintViolationException::class
    836▕                 : QueryException::class;
    837▕ 
  ➜ 838▕             throw new $exceptionType(
    839▕                 $this->getNameWithReadWriteType(),
    840▕                 $query,
    841▕                 $this->prepareBindings($bindings),
    842▕                 $e,

      [2m+8 vendor frames [22m
  9   tests/Feature/Api/V1/Whatsapp/WhatsappInviteControllerTest.php:134
  10  tests/Feature/Api/V1/Whatsapp/WhatsappInviteControllerTest.php:46

  ────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\Api\V1\Whatsapp\WhatsappInviteContr…  QueryException   
  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: classSection.semester (Connection: sqlite, Database: :memory:, SQL: insert into "classSection" ("class_section_id", "class_section_name", "class_id", "created_at", "updated_at") values (200, Grade 1, 1, 2026-03-10 20:29:56, 2026-03-10 20:29:56))

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
    834▕             $exceptionType = $this->isUniqueConstraintError($e)
    835▕                 ? UniqueConstraintViolationException::class
    836▕                 : QueryException::class;
    837▕ 
  ➜ 838▕             throw new $exceptionType(
    839▕                 $this->getNameWithReadWriteType(),
    840▕                 $query,
    841▕                 $this->prepareBindings($bindings),
    842▕                 $e,

      [2m+8 vendor frames [22m
  9   tests/Feature/Api/V1/Whatsapp/WhatsappInviteControllerTest.php:134
  10  tests/Feature/Api/V1/Whatsapp/WhatsappInviteControllerTest.php:60

  ────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\Api\V1\Whatsapp\WhatsappInviteContr…  QueryException   
  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: classSection.semester (Connection: sqlite, Database: :memory:, SQL: insert into "classSection" ("class_section_id", "class_section_name", "class_id", "created_at", "updated_at") values (200, Grade 1, 1, 2026-03-10 20:29:56, 2026-03-10 20:29:56))

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
    834▕             $exceptionType = $this->isUniqueConstraintError($e)
    835▕                 ? UniqueConstraintViolationException::class
    836▕                 : QueryException::class;
    837▕ 
  ➜ 838▕             throw new $exceptionType(
    839▕                 $this->getNameWithReadWriteType(),
    840▕                 $query,
    841▕                 $this->prepareBindings($bindings),
    842▕                 $e,

      [2m+8 vendor frames [22m
  9   tests/Feature/Api/V1/Whatsapp/WhatsappInviteControllerTest.php:134
  10  tests/Feature/Api/V1/Whatsapp/WhatsappInviteControllerTest.php:81

  ────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\Api\V1\Whatsapp\WhatsappInviteContr…  QueryException   
  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: classSection.semester (Connection: sqlite, Database: :memory:, SQL: insert into "classSection" ("class_section_id", "class_section_name", "class_id", "created_at", "updated_at") values (200, Grade 1, 1, 2026-03-10 20:29:57, 2026-03-10 20:29:57))

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:838
    834▕             $exceptionType = $this->isUniqueConstraintError($e)
    835▕                 ? UniqueConstraintViolationException::class
    836▕                 : QueryException::class;
    837▕ 
  ➜ 838▕             throw new $exceptionType(
    839▕                 $this->getNameWithReadWriteType(),
    840▕                 $query,
    841▕                 $this->prepareBindings($bindings),
    842▕                 $e,

      [2m+8 vendor frames [22m
  9   tests/Feature/Api/V1/Whatsapp/WhatsappInviteControllerTest.php:134
  10  tests/Feature/Api/V1/Whatsapp/WhatsappInviteControllerTest.php:99

  ────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\Api\V1\Whatsapp\WhatsappLinkControllerTest > store…    
  Expected response status code [201] but received 422.
Failed asserting that 422 is identical to 201.

The following errors occurred during the last request:

{
    "message": "Validation failed.",
    "errors": {
        "class_section_id": [
            "The class section id field is required."
        ],
        "invite_link": [
            "The invite link field is required."
        ]
    }
}

  at tests/Feature/Api/V1/Whatsapp/WhatsappLinkControllerTest.php:78
     74▕         ];
     75▕ 
     76▕         $response = $this->postJson('/api/v1/whatsapp/links', $payload);
     77▕ 
  ➜  78▕         $response->assertStatus(201);
     79▕         $response->assertJsonPath('status', true);
     80▕         $this->assertDatabaseHas('whatsapp_group_links', [
     81▕             'class_section_id' => 202,
     82▕             'invite_link' => 'https://chat.whatsapp.com/new',

  ────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\Api\V1\Whatsapp\WhatsappLinkControllerTest > update…   
  Failed asserting that a row in the table [whatsapp_group_links] matches the attributes {
    "id": 1,
    "invite_link": "https:\/\/chat.whatsapp.com\/updated",
    "active": 0
}.

Found similar results: [
    {
        "id": 1,
        "invite_link": "https:\/\/chat.whatsapp.com\/old",
        "active": 1
    }
].

  at tests/Feature/Api/V1/Whatsapp/WhatsappLinkControllerTest.php:109
    105▕         ]);
    106▕ 
    107▕         $response->assertOk();
    108▕         $response->assertJsonPath('status', true);
  ➜ 109▕         $this->assertDatabaseHas('whatsapp_group_links', [
    110▕             'id' => $linkId,
    111▕             'invite_link' => 'https://chat.whatsapp.com/updated',
    112▕             'active' => 0,
    113▕         ]);


  Tests:    10 failed, 21 passed (52 assertions)
  Duration: 7.96s
