AlkantarClanX12

Your IP : 216.73.217.24


Current Path : /www/capitalgmcbuickregina_830/public/wp-content/plugins/leadbox/tests/unit/
Upload File :
Current File : /www/capitalgmcbuickregina_830/public/wp-content/plugins/leadbox/tests/unit/SettingsUrlTest.php

<?php

use PHPUnit\Framework\TestCase;

/**
 * LBT-1468 — Unit tests for LB_API_Settings::sanitizeLeadIntakeUrl().
 *
 * Pure-PHP: covers the configurable lead-intake URL resolution — blank/invalid
 * values fall back to the default, scheme is normalised, trailing slash stripped.
 * The constructor (get_option) is WordPress-only and not exercised here.
 */
final class SettingsUrlTest extends TestCase
{
  const DEFAULT_URL = 'https://os.leadboxhq.com';

  private function sanitize($raw)
  {
    return LB_API_Settings::sanitizeLeadIntakeUrl($raw, self::DEFAULT_URL);
  }

  /* ---------------- fallback to default ---------------- */

  public function test_blank_falls_back_to_default(): void
  {
    $this->assertSame(self::DEFAULT_URL, $this->sanitize(''));
    $this->assertSame(self::DEFAULT_URL, $this->sanitize('   '));
  }

  public function test_invalid_url_falls_back_to_default(): void
  {
    // No host after the scheme is prepended.
    $this->assertSame(self::DEFAULT_URL, $this->sanitize('not a url'));
    $this->assertSame(self::DEFAULT_URL, $this->sanitize('https://'));
  }

  /* ---------------- valid overrides ---------------- */

  public function test_valid_https_url_is_kept(): void
  {
    $this->assertSame('https://intake.example.com', $this->sanitize('https://intake.example.com'));
  }

  public function test_missing_scheme_gets_https(): void
  {
    $this->assertSame('https://intake.example.com', $this->sanitize('intake.example.com'));
    $this->assertSame('https://intake.example.com', $this->sanitize('//intake.example.com'));
  }

  public function test_http_is_upgraded_to_https(): void
  {
    $this->assertSame('https://intake.example.com', $this->sanitize('http://intake.example.com'));
  }

  /* ---------------- normalisation ---------------- */

  public function test_trailing_slash_is_stripped(): void
  {
    $this->assertSame('https://intake.example.com', $this->sanitize('https://intake.example.com/'));
    $this->assertSame('https://intake.example.com', $this->sanitize('intake.example.com//'));
  }

  public function test_surrounding_whitespace_is_trimmed(): void
  {
    $this->assertSame('https://intake.example.com', $this->sanitize('  https://intake.example.com  '));
  }

  public function test_path_and_port_are_preserved(): void
  {
    $this->assertSame('https://intake.example.com:8443/base', $this->sanitize('https://intake.example.com:8443/base'));
  }

  /* ---------------- the default itself round-trips ---------------- */

  public function test_explicit_default_value_is_kept(): void
  {
    $this->assertSame(self::DEFAULT_URL, $this->sanitize(self::DEFAULT_URL));
  }

  /* ---------------- loopback carve-out (local dev) ---------------- */

  public function test_http_loopback_is_kept_as_http(): void
  {
    $this->assertSame('http://localhost', $this->sanitize('http://localhost'));
    $this->assertSame('http://localhost:8000', $this->sanitize('http://localhost:8000'));
    $this->assertSame('http://127.0.0.1:8080', $this->sanitize('http://127.0.0.1:8080'));
    $this->assertSame('http://platform.local', $this->sanitize('http://platform.local'));
    $this->assertSame('http://leadbox.test', $this->sanitize('http://leadbox.test'));
  }

  public function test_http_loopback_trailing_slash_is_stripped(): void
  {
    $this->assertSame('http://localhost:8000', $this->sanitize('http://localhost:8000/'));
  }

  public function test_https_loopback_is_kept(): void
  {
    $this->assertSame('https://localhost:8443', $this->sanitize('https://localhost:8443'));
  }

  public function test_non_loopback_http_is_still_upgraded(): void
  {
    $this->assertSame('https://intake.example.com', $this->sanitize('http://intake.example.com'));
  }

  /* ---------------- isLoopbackHost ---------------- */

  public function test_is_loopback_host(): void
  {
    foreach (array('localhost', '127.0.0.1', '127.1.2.3', '::1', 'foo.local', 'bar.test', 'LOCALHOST') as $h) {
      $this->assertTrue(LB_API_Settings::isLoopbackHost($h), $h);
    }
    foreach (array('os.leadboxhq.com', 'example.com', '8.8.8.8', '', null) as $h) {
      $this->assertFalse(LB_API_Settings::isLoopbackHost($h), var_export($h, true));
    }
  }
}

Home - Capital GMC Buick Regina

No data

Welcome to Capital GMC BUICK – REGINA

Thank you for choosing Capital GMC Buick | Regina, your premier certified Buick and GMC dealership proudly serving drivers in Regina and the surrounding communities. Whether you’re searching for a brand-new Buick or GMC vehicle or a meticulously inspected pre-owned model, we have a diverse selection to match your needs and lifestyle.

Beyond our impressive inventory, we offer a seamless and stress-free financing experience through our well-connected finance centre, where our team of experts is dedicated to securing the best loan or lease options for you, quickly, transparently, and hassle-free.

But our commitment to you doesn’t stop at the sale. Our state-of-the-art service centre is staffed with skilled Buick and GMC technicians who use the latest equipment and genuine OEM parts to keep your vehicle running at its best. From routine maintenance to complex repairs, we’ve got you covered.

Experience top-tier customer service, quality vehicles, and expert care, all in one place. Visit Capital GMC Buick | Regina today or call us at 306-205-8072 with any questions. We’re here to help!

Ask a Question