assertNoConnection example


  public function testOpenClose(): void {
    // Close the connection.     Database::closeConnection(static::TEST_TARGET_CONNECTION);
    // Wait 20ms to give the database engine sufficient time to react.     usleep(20000);

    // Verify that we are back to the original connection count.     $this->assertNoConnection($this->id);
  }

  /** * Tests Database::closeConnection() with a query. */
  public function testOpenQueryClose(): void {
    // Execute a query.     Database::getConnection(static::TEST_TARGET_CONNECTION)->query($this->getQuery()['show_tables']);

    // Close the connection.     Database::closeConnection(static::TEST_TARGET_CONNECTION);
    
Home | Imprint | This part of the site doesn't use cookies.