PHP Classes

File: tests/Unit/Customs/CustomPathsTest.php

Recommend this page to a friend!
  Packages of Amirreza Ebrahimi   HeroQR Powerful PHP QR Code Library to generate PNG, SVG, PDF, Logos Ready to Use with Laravel   tests/Unit/Customs/CustomPathsTest.php   Download  
File: tests/Unit/Customs/CustomPathsTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: HeroQR Powerful PHP QR Code Library to generate PNG, SVG, PDF, Logos Ready to Use with Laravel
Generate QR code images in several formats
Author: By
Last change:
Date: 23 days ago
Size: 1,749 bytes
 

Contents

Class file image Download
<?php

namespace HeroQR\Tests\Unit\Customs;

use
HeroQR\Customs\{MarkerPaths,ShapePaths,CursorPaths};
use
PHPUnit\Framework\{Attributes\Test, TestCase};

/**
 * Class CustomPathsTest
 * Tests CursorPaths, MarkerPaths, and ShapePaths classes.
 */
class CustomPathsTest extends TestCase
{
   
/**
     * Test CursorPaths: Check if constants exist and files are readable
     */
    #[Test]
   
public function isAllCursorPathsExist(): void
   
{
       
$paths = CursorPaths::getAllPaths();

       
$this->assertCount(6, $paths, "CursorPaths should have 6 constants starting with 'C'.");

        foreach (
$paths as $path) {
           
$this->assertFileExists($path, "Cursor asset file not found at: $path");
           
$this->assertStringEndsWith('.png', $path);
        }
    }

   
/**
     * Test MarkerPaths: Check if constants exist and files are readable
     */
    #[Test]
   
public function isAllMarkerPathsExist(): void
   
{
       
$paths = MarkerPaths::getAllPaths();

       
$this->assertCount(6, $paths, "MarkerPaths should have 6 constants starting with 'M'.");

        foreach (
$paths as $path) {
           
$this->assertFileExists($path, "Marker asset file not found at: $path");
           
$this->assertStringEndsWith('.png', $path);
        }
    }

   
/**
     * Test ShapePaths: Check if constants match the expected drawing methods
     */
    #[Test]
   
public function isShapePathsAreCorrectStrings(): void
   
{
       
$paths = ShapePaths::getAllPaths();

       
$this->assertCount(4, $paths);
       
$this->assertContains('drawSquare', $paths);
       
$this->assertContains('drawCircle', $paths);
       
$this->assertContains('drawStar', $paths);
       
$this->assertContains('drawDiamond', $paths);
    }
}