test/snac/util/EACCPFParserTest.php
/**
     * Test that giving the parser a bad filename will throw the right exception.
     */
Test that giving the parser a bad filename will throw the right exception.
Test that giving the parser a bad filename will throw the right exception .
public function testBadFilename() {
        $parser = new \snac\util\EACCPFParser();
        try {
            $parser->parseFile("Not-a-valid-filename");
        } catch (\snac\exceptions\SNACParserException $e) {
            $this->assertStringStartsWith(
                "file_get_contents(Not-a-valid-filename): failed to open stream: No such file or directory",
                $e->getMessage(),
                "The wrong exception was encountered in the code, but it still correctly throw the SNACParserException");
        } catch (\Exception $e) {
            $this->fail("Parser threw the wrong exception");
        }
    }
public function testBadFilename ( ) { $ parser = new \ snac \ util \ EACCPFParser ( ) ; try { $ parser -> parseFile ( " Not-a-valid-filename " ) ; } catch ( \ snac \ exceptions \ SNACParserException $ e ) { $ this -> assertStringStartsWith ( " file_get_contents(Not-a-valid-filename): failed to open stream: No such file or directory " , $ e -> getMessage ( ) , " The wrong exception was encountered in the code, but it still correctly throw the SNACParserException " ) ; } catch ( \ Exception $ e ) { $ this -> fail ( " Parser threw the wrong exception " ) ; } }
Test that giving the parser a bad filename will throw the right exception.
Test that giving the parser a bad filename will throw the right exception .
// $parser->setVocabulary(new TestVocabulary()); // Catching this exception passes