Пример #1
0
 public function testCompleteArray()
 {
     global $config;
     $_SERVER["HTTP_USER_AGENT"] = "Firefox";
     $test = array();
     $test = JSONRenderer::addCompleteArray($test);
     $this->assertArrayHasKey("c", $test);
     $this->assertArrayHasKey("version", $test["c"]);
     $this->assertArrayHasKey("i18n", $test["c"]);
     $this->assertArrayHasKey("url", $test["c"]);
     $this->assertArrayHasKey("config", $test["c"]);
     $this->assertFalse($test["c"]["url"]["thumbnailUrl"] == $test["c"]["url"]["coverUrl"]);
     // The thumbnails should be the same as the covers
     $config['cops_thumbnail_handling'] = "1";
     $test = array();
     $test = JSONRenderer::addCompleteArray($test);
     $this->assertTrue($test["c"]["url"]["thumbnailUrl"] == $test["c"]["url"]["coverUrl"]);
     // The thumbnails should be the same as the covers
     $config['cops_thumbnail_handling'] = "/images.png";
     $test = array();
     $test = JSONRenderer::addCompleteArray($test);
     $this->assertEquals("/images.png", $test["c"]["url"]["thumbnailUrl"]);
 }