1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?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>');
- }
- }
|