File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ declare (strict_types = 1 );
3
+
4
+ namespace Forensic \FeedParser \Test ;
5
+
6
+ use Forensic \FeedParser \Parser ;
7
+ use PHPUnit \Framework \TestCase ;
8
+ use Forensic \FeedParser \Exceptions \InvalidURLException ;
9
+ use Forensic \FeedParser \Exceptions \ResourceNotFoundException ;
10
+ use Forensic \FeedParser \Exceptions \FileNotFoundException ;
11
+
12
+ class ParserTest extends TestCase
13
+ {
14
+ private $ _parser = null ;
15
+
16
+ public function setup ()
17
+ {
18
+ $ this ->_parser = new Parser ();
19
+ }
20
+
21
+ public function testInvalidUrl ()
22
+ {
23
+ $ this ->expectException (InvalidURLException::class);
24
+ $ this ->_parser ->parseFromUrl ('www.google.com ' );
25
+ }
26
+
27
+ public function testUnExistingUrl ()
28
+ {
29
+ $ this ->expectException (ResourceNotFoundException::class);
30
+ $ this ->_parser ->parseFromUrl ('http://feed.fjsfoundations.com ' );
31
+ }
32
+
33
+ public function testUnExistingFile ()
34
+ {
35
+ $ this ->expectException (FileNotFoundException::class);
36
+ $ this ->_parser ->parseFromFile ('./somefile.xml ' );
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments