@@ -73,82 +73,50 @@ public function testGetNextPageCustomPath() {
7373
7474
7575 /**
76- * Asserts that InvalidArgumentException is thrown while passing a string to default xpath
77- *
76+ * @expectedException InvalidArgumentException
7877 */
7978 public function testXpathCorrectString () {
8079 $ grabber = new TestGrabber ();
8180 $ linksArrayPath = $ grabber ; // passing wrong path
8281
83- $ exception = null ;
84- try {
85- new RecursivePagination ($ grabber , $ linksArrayPath );
86- } catch (InvalidArgumentException $ e ) {
87- $ this ->assertTrue (true );
88- return ;
89- }
90- $ this ->fail ('Unexpected exception type ' );
82+ new RecursivePagination ($ grabber , $ linksArrayPath );
9183 }
9284
9385
9486 /**
95- * Asserts that InvalidArgumentException is thrown while passing an array to default xpath
96- *
87+ * @expectedException InvalidArgumentException
9788 */
9889 public function testXpathCorrectArray () {
9990 $ grabber = new TestGrabber ();
10091 $ linksArrayPath = ["//span[@class='inner'][1]/a/@href " , "//a[@class='pagenav']/@href " , $ grabber ]; // passing wrong path
10192
102- $ exception = null ;
103- try {
104- new RecursivePagination ($ grabber , $ linksArrayPath );
105- } catch (InvalidArgumentException $ e ) {
106- $ this ->assertTrue (true );
107- return ;
108- }
109- $ this ->fail ('Unexpected exception type ' );
93+ new RecursivePagination ($ grabber , $ linksArrayPath );
11094 }
11195
11296
11397 /**
114- * Asserts that InvalidArgumentException is thrown while passing array of links to queue
115- *
98+ * @expectedException InvalidArgumentException
11699 */
117100 public function testAddToQueueLinksArray () {
118101 $ grabber = new TestGrabber ();
119102 $ linksArrayPath = ["//span[@class='inner']/a/@href " , "//a[@class='pagenav']/@href " ];
120103
121- $ exception = null ;
122- try {
123- $ paginator = new RecursivePagination ($ grabber , $ linksArrayPath );
124- $ paginator ->addToQueue ([
125- 'osmosis/page1.html ' ,
126- $ grabber , //wrong link
127- ]);
128- } catch (InvalidArgumentException $ e ) {
129- $ this ->assertTrue (true );
130- return ;
131- }
132- $ this ->fail ('Unexpected exception type ' );
104+ $ paginator = new RecursivePagination ($ grabber , $ linksArrayPath );
105+ $ paginator ->addToQueue ([
106+ 'osmosis/page1.html ' ,
107+ $ grabber , //wrong link
108+ ]);
133109 }
134110
135111
136112 /**
137- * Asserts that InvalidArgumentException is thrown while passing one link to queue
138- *
113+ * @expectedException InvalidArgumentException
139114 */
140115 public function testAddToQueueLink () {
141116 $ grabber = new TestGrabber ();
142117 $ linksArrayPath = ["//span[@class='inner']/a/@href " , "//a[@class='pagenav']/@href " ];
143118
144- $ exception = null ;
145- try {
146- $ paginator = new RecursivePagination ($ grabber , $ linksArrayPath );
147- $ paginator ->addToQueue ($ grabber ); //wrong link
148- } catch (InvalidArgumentException $ e ) {
149- $ this ->assertTrue (true );
150- return ;
151- }
152- $ this ->fail ('Unexpected exception type ' );
119+ $ paginator = new RecursivePagination ($ grabber , $ linksArrayPath );
120+ $ paginator ->addToQueue ($ grabber ); //wrong link
153121 }
154122 }
0 commit comments