DataSift\Storyplayer\PlayerLib\Story_LoaderTest::testThrowsExceptionIfInvalidFilenameProvided PHP Method

testThrowsExceptionIfInvalidFilenameProvided() public method

    public function testThrowsExceptionIfInvalidFilenameProvided()
    {
        // ----------------------------------------------------------------
        // setup the test
        $filename = __DIR__ . '/test-stories/filedoesnotexist.php';
        $expectedCode = 500;
        $expectedMessage = "Cannot find file '{$filename}' to load";
        // ----------------------------------------------------------------
        // perform the change
        // this should throw an exception
        $caughtException = false;
        try {
            Story_Loader::loadStory($filename);
        } catch (Exception $e) {
            $caughtException = $e;
        }
        // ----------------------------------------------------------------
        // test the results
        $this->assertTrue($caughtException instanceof E5xx_InvalidStoryFile);
        $this->assertEquals($expectedCode, $caughtException->getCode());
        $this->assertEquals($expectedMessage, $caughtException->getMessage());
    }