DataSift\Storyplayer\ConfigLib\WrappedConfigTest::testThrowsExceptionWhenConfigFileIsInvalidJson PHP Method

testThrowsExceptionWhenConfigFileIsInvalidJson() public method

    public function testThrowsExceptionWhenConfigFileIsInvalidJson()
    {
        // ----------------------------------------------------------------
        // setup your test
        $expectedConfig = new BaseObject();
        $expectedName = WrappedConfig::NO_NAME;
        $obj = new WrappedConfig();
        // ----------------------------------------------------------------
        // perform the change
        $caughtException = false;
        try {
            $obj->loadConfigFromFile(__DIR__ . "/wrapped-config-is-invalid-json.json");
        } catch (E4xx_ConfigFileContainsInvalidJson $e) {
            $caughtException = true;
        }
        // ----------------------------------------------------------------
        // test the results
        $this->assertTrue($caughtException);
        // make sure the rest of the object has been left alone
        $actualConfig = $obj->getConfig();
        $actualName = $obj->getName();
        $this->assertEquals($expectedConfig, $actualConfig);
        $this->assertEquals($expectedName, $actualName);
    }
WrappedConfigTest