@@ -269,51 +269,40 @@ public function testGetoptUnSetBeforeParse()
269
269
$ this ->assertFalse (isset ($ opts ->a ));
270
270
}
271
271
272
- public function testVerifyRequiredArgument (){
273
- $ opts = new Zend_Console_Getopt (array (
274
- 'apple|a=s ' =>"First required argument "
275
- ));
272
+ public function testVerifyRequiredArgument ()
273
+ {
274
+ $ opts = new Zend_Console_Getopt (array ('apple|a=s ' => "First required argument " ));
276
275
try {
277
276
$ opts ->parse ();
278
277
$ opts ->checkRequiredArguments ();
279
278
$ this ->fail ('Expected to catch a Zend_Console_Getopt_Exception ' );
280
279
}
281
- catch (Exception $ e ){
280
+ catch (Zend_Exception $ e ){
282
281
$ this ->assertTrue ($ e instanceof Zend_Console_Getopt_Exception,
283
- 'Expected Zend_Console_Getopt_Exception, got ' . get_class ($ e ));
284
-
285
- $ this ->assertEquals ( 'Option "a" requires a parameter. ' , $ e ->getMessage () );
282
+ 'Expected Zend_Console_Getopt_Exception, got ' . get_class ($ e ));
283
+ $ this ->assertEquals ('Option "a" requires a parameter. ' , $ e ->getMessage ());
286
284
}
287
285
288
- $ opts ->addArguments ( array ( "-a " , "apple " ) );
286
+ $ opts ->addArguments (array ( "-a " , "apple " ) );
289
287
$ opts ->parse ();
290
288
$ opts ->checkRequiredArguments ();//-> no Exception here
291
289
}
292
290
293
- public function testEmptyRequiredOption (){
294
-
291
+ public function testEmptyRequiredOption ()
292
+ {
295
293
$ opts = new Zend_Console_Getopt (array (
296
294
'apple|a=s ' =>"First required argument " ,
297
295
'banana|b=i ' =>"Second required argument "
298
- ));
299
-
300
- $ opts ->addArguments (array (
301
- "-a " ,
302
- "-b " ,
303
- "123 "
304
- ));
305
-
296
+ ));
297
+ $ opts ->addArguments (array ("-a " ,"-b " ,"123 " ));
306
298
try {
307
299
$ opts ->parse ();
308
300
$ opts ->checkRequiredArguments ();
309
- $ this ->fail ('Expected to catch a Zend_Console_Getopt_Exception ' );
310
-
311
- } catch (Exception $ e ) {
312
-
301
+ $ this ->fail ('Expected to catch a Zend_Console_Getopt_Exception ' );
302
+ } catch (Zend_Exception $ e ) {
313
303
$ this ->assertTrue ($ e instanceof Zend_Console_Getopt_Exception,
314
- 'Expected Zend_Console_Getopt_Exception, got ' . get_class ($ e ));
315
-
316
- $ this ->assertEquals ( 'Option "a" requires a parameter. ' , $ e ->getMessage () );
304
+ 'Expected Zend_Console_Getopt_Exception, got ' . get_class ($ e ));
305
+ $ this ->assertEquals ('Option "a" requires a parameter. ' , $ e ->getMessage ());
317
306
}
318
307
}
319
308
0 commit comments