示例#1
0
 public function testFile()
 {
     $filename = __DIR__ . '/../../_data/sample.js';
     $key = $this->api->file()->post($filename);
     $this->api->preview()->putCustomize($this->appId, [['type' => 'FILE', 'file' => ['fileKey' => $key]]]);
     $fileKey = $this->api->preview()->getCustomize($this->appId)['desktop']['js'][0]['file']['fileKey'];
     $content = $this->api->file()->get($fileKey);
     self::assertEquals(file_get_contents($filename), $content);
     $key = $this->api->file()->post($filename, $this->guestSpaceId);
     $this->api->preview()->putCustomize($this->guestAppId, [['type' => 'FILE', 'file' => ['fileKey' => $key]]], [], [], $this->guestSpaceId);
     $fileKey = $this->api->preview()->getCustomize($this->guestAppId, $this->guestSpaceId)['desktop']['js'][0]['file']['fileKey'];
     $content = $this->api->file()->get($fileKey, $this->guestSpaceId);
     self::assertEquals(file_get_contents($filename), $content);
 }
示例#2
0
 public function testCustomize()
 {
     $this->api->preview()->putCustomize($this->appId, [['type' => 'URL', 'url' => 'https://www.example.com/example.js']], [['type' => 'URL', 'url' => 'https://www.example.com/example.css']], [['type' => 'URL', 'url' => 'https://www.example.com/example-mobile.js']]);
     $customize = $this->api->preview()->getCustomize($this->appId);
     self::assertEquals($customize['desktop']['js'][0], ['type' => 'URL', 'url' => 'https://www.example.com/example.js']);
     self::assertEquals($customize['desktop']['css'][0], ['type' => 'URL', 'url' => 'https://www.example.com/example.css']);
     self::assertEquals($customize['mobile']['js'][0], ['type' => 'URL', 'url' => 'https://www.example.com/example-mobile.js']);
     $this->api->preview()->putCustomize($this->guestAppId, [['type' => 'URL', 'url' => 'https://www.example.com/example.js']], [['type' => 'URL', 'url' => 'https://www.example.com/example.css']], [['type' => 'URL', 'url' => 'https://www.example.com/example-mobile.js']], $this->guestSpaceId, 'ADMIN');
     $customize = $this->api->preview()->getCustomize($this->guestAppId, $this->guestSpaceId);
     self::assertEquals($customize['desktop']['js'][0], ['type' => 'URL', 'url' => 'https://www.example.com/example.js']);
     self::assertEquals($customize['desktop']['css'][0], ['type' => 'URL', 'url' => 'https://www.example.com/example.css']);
     self::assertEquals($customize['mobile']['js'][0], ['type' => 'URL', 'url' => 'https://www.example.com/example-mobile.js']);
     self::assertEquals($customize['scope'], 'ADMIN');
 }
示例#3
0
 public function testPreview()
 {
     self::assertTrue($this->api->preview() instanceof PreviewApp);
 }