2023-04-12 00:27:35 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use Shikiryu\SRSS\Exception\ChannelNotFoundInRSSException;
|
|
|
|
use Shikiryu\SRSS\Exception\PropertyNotFoundException;
|
|
|
|
use Shikiryu\SRSS\Exception\UnreadableRSSException;
|
|
|
|
use Shikiryu\SRSS\SRSS;
|
|
|
|
|
|
|
|
class ExceptionTest extends TestCase
|
|
|
|
{
|
2023-04-12 15:28:38 +02:00
|
|
|
public function testPropertyNotFound(): void
|
2023-04-12 00:27:35 +02:00
|
|
|
{
|
|
|
|
$srss = new SRSS();
|
|
|
|
$this->expectException(PropertyNotFoundException::class);
|
|
|
|
$srss->notfound = 'true';
|
|
|
|
}
|
|
|
|
|
2023-04-12 15:28:38 +02:00
|
|
|
public function testRssNotFound(): void
|
2023-04-12 00:27:35 +02:00
|
|
|
{
|
|
|
|
$this->expectException(UnreadableRSSException::class);
|
2023-04-12 15:28:38 +02:00
|
|
|
SRSS::read('not_found.xml');
|
2023-04-12 00:27:35 +02:00
|
|
|
}
|
|
|
|
|
2023-04-12 15:28:38 +02:00
|
|
|
public function testMissingChannel(): void
|
2023-04-12 00:27:35 +02:00
|
|
|
{
|
|
|
|
$this->expectException(ChannelNotFoundInRSSException::class);
|
2023-04-12 15:28:38 +02:00
|
|
|
SRSS::read(__DIR__ . '/resources/invalid-no-channel.xml');
|
2023-04-12 00:27:35 +02:00
|
|
|
}
|
|
|
|
}
|