Page MenuHomeDevCentral

CodeFileTest.php
No OneTemporary

CodeFileTest.php

<?php
declare(strict_types=1);
namespace Keruald\OmniTools\Tests\Reflection;
use Keruald\OmniTools\Reflection\CodeFile;
use Keruald\OmniTools\Tests\WithData;
use PHPUnit\Framework\TestCase;
use Acme\MockLib\Bar; // a mock class in a mock namespace to test include
class CodeFileTest extends TestCase {
use WithData;
/**
* @var CodeFile
*/
private $validCodeFile;
/**
* @var CodeFile
*/
private $notExistingCodeFile;
public function setUp () : void {
$file = $this->getDataPath("MockLib/Bar.php");
$this->validCodeFile = CodeFile::from($file);
$this->notExistingCodeFile = CodeFile::from("/notexisting");
}
public function testCanInclude () : void {
$this->assertTrue($this->validCodeFile->canBeIncluded());
$this->assertFalse($this->notExistingCodeFile->canBeIncluded());
}
public function testTryInclude () : void {
$this->assertTrue($this->validCodeFile->tryInclude());
$this->assertTrue(class_exists(Bar::class));
$this->assertFalse($this->notExistingCodeFile->tryInclude());
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Mar 7, 01:54 (23 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3498487
Default Alt Text
CodeFileTest.php (1 KB)

Event Timeline