Beispiel #1
0
    /**
     * Tests ContainerConfig::removeComments()
     */
    public function testRemoveComments()
    {
        $jsFile = <<<EOD
/*
 * Comments
 */

// Comments
{"gadgets.container" : ["default"],
"gadgets.parent" : null,
"gadgets.lockedDomainSuffix" : "-a.example.com:8080",
"gadgets.iframeBaseUri" : "/gadgets/ifr",
"gadgets.jsUriTemplate" : "http://%host%/gadgets/js/%js%",
"gadgets.oauthGadgetCallbackTemplate" : "//%host%/gadgets/oauthcallback"
}
EOD;
        $uncommented = ContainerConfig::removeComments($jsFile);
        $jsonObj = json_decode($uncommented, true);
        $this->assertNotEquals($uncommented, $jsonObj);
        $this->assertEquals(array("default"), $jsonObj["gadgets.container"]);
        $this->assertEquals(null, $jsonObj["gadgets.parent"]);
        $this->assertEquals("-a.example.com:8080", $jsonObj["gadgets.lockedDomainSuffix"]);
        $this->assertEquals("/gadgets/ifr", $jsonObj["gadgets.iframeBaseUri"]);
        $this->assertEquals("http://%host%/gadgets/js/%js%", $jsonObj["gadgets.jsUriTemplate"]);
        $this->assertEquals("//%host%/gadgets/oauthcallback", $jsonObj["gadgets.oauthGadgetCallbackTemplate"]);
    }