public function testThrowsExceptionIfStoryVariableDefinedWithWrongType() { // ---------------------------------------------------------------- // setup the test $filename = __DIR__ . '/test-stories/DeclaresStoryOfWrongType.php'; $expectedCode = 500; $expectedMessage = "Story file '{$filename}' did create a \$story variable, but it is of type 'stdClass' instead of type 'DataSift\\Storyplayer\\PlayerLib\\Story'"; // ---------------------------------------------------------------- // 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()); }