123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?php
- namespace PharIo\Manifest;
- class ManifestLoaderTest extends \PHPUnit\Framework\TestCase {
- public function testCanBeLoadedFromFile() {
- $this->assertInstanceOf(
- Manifest::class,
- ManifestLoader::fromFile(__DIR__ . '/_fixture/library.xml')
- );
- }
- public function testCanBeLoadedFromString() {
- $this->assertInstanceOf(
- Manifest::class,
- ManifestLoader::fromString(
- file_get_contents(__DIR__ . '/_fixture/library.xml')
- )
- );
- }
- public function testCanBeLoadedFromPhar() {
- $this->assertInstanceOf(
- Manifest::class,
- ManifestLoader::fromPhar(__DIR__ . '/_fixture/test.phar')
- );
- }
- public function testLoadingNonExistingFileThrowsException() {
- $this->expectException(ManifestLoaderException::class);
- ManifestLoader::fromFile('/not/existing');
- }
-
- public function testLoadingInvalidXmlThrowsException() {
- $this->expectException(ManifestLoaderException::class);
- ManifestLoader::fromString('<?xml version="1.0" ?><broken>');
- }
- }
|