Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
HeadersHelperTest.php
1 <?php
2 /**
3  * Gentics Portal.Node PHP
4  * Author & Copyright (c) by Gentics Software GmbH
5  * sales@gentics.com
6  * http://www.gentics.com
7  * Licenses can be found in the LICENSE.txt file in the root-folder of this installation
8  * You must not use this software without a valid license agreement.
9  *
10  */
11 class HeadersHelperTest extends CTestCase
12 {
13  public function testForFile()
14  {
15  $path = 'file.css';
16  $content = '1234567890';
17  $headers = HeadersHelper::forFile($path, $content);
18  $this->assertTrue(in_array('Content-Type: text/css', $headers));
19  $this->assertTrue(in_array('Content-Length: 10', $headers));
20 
21  $path = 'file.jpg';
22  $headers = HeadersHelper::forFile($path, $content);
23  $this->assertTrue(in_array('Content-Type: image/jpeg', $headers));
24  }
25 
26  public function testCache()
27  {
28  $seconds = 3600;
29  $headers = HeadersHelper::cache($seconds);
30  $this->assertTrue(in_array('Pragma: public', $headers));
31  $this->assertTrue(in_array('Cache-Control: public', $headers));
32  $this->assertTrue(in_array("Expires: " . date("r", time() + $seconds), $headers));
33  }
34 }