Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /home/dnlcambodia/www/dnl_dashboard/Export/vendor/maennchen/zipstream-php/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/dnlcambodia/www/dnl_dashboard/Export/vendor/maennchen/zipstream-php/test/Assertions.php
<?php

declare(strict_types=1);

namespace ZipStream\Test;

trait Assertions
{
    protected function assertFileContains(string $filePath, string $needle): void
    {
        $last = '';

        $handle = fopen($filePath, 'r');
        while (!feof($handle)) {
            $line = fgets($handle, 1024);

            if(str_contains($last . $line, $needle)) {
                fclose($handle);
                return;
            }

            $last = $line;
        }

        fclose($handle);

        $this->fail("File {$filePath} must contain {$needle}");
    }

    protected function assertFileDoesNotContain(string $filePath, string $needle): void
    {
        $last = '';

        $handle = fopen($filePath, 'r');
        while (!feof($handle)) {
            $line = fgets($handle, 1024);

            if(str_contains($last . $line, $needle)) {
                fclose($handle);

                $this->fail("File {$filePath} must not contain {$needle}");
            }

            $last = $line;
        }

        fclose($handle);
    }
}

ZeroDay Forums Mini