diff options
author | Evan Prodromou <evan@status.net> | 2009-12-07 12:13:42 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-12-07 12:13:42 -0500 |
commit | 0c955b7c88b41fa28d079eb639abb748583ab4eb (patch) | |
tree | c6e3dd1597c9a96bc1e1851f6fd7b5acd5a4de6e /plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet | |
parent | 11dab47e2d91c7f88819a1576609d7ef7f63ee64 (diff) |
remove unit tests for minify
Diffstat (limited to 'plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet')
6 files changed, 0 insertions, 260 deletions
diff --git a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/2.php b/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/2.php deleted file mode 100644 index 9b66f2493..000000000 --- a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/2.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../min/lib')); -require 'HTTP/ConditionalGet.php'; - -// emulate regularly updating document -$every = 20; -$lastModified = round(time()/$every)*$every - $every; - -$cg = new HTTP_ConditionalGet(array( - 'lastModifiedTime' => $lastModified -)); -if ($cg->cacheIsValid) { - $cg->sendHeaders(); - // we're done - exit(); -} - -// generate content -$title = 'Last-Modified is known : add Content-Length'; -$explain = ' -<p>Here, like <a href="./">the first example</a>, we know the Last-Modified time, -but we also want to set the Content-Length to increase cacheability and allow -HTTP persistent connections. Instead of sending headers immediately, we first -generate our content, then use <code>setContentLength(strlen($content))</code> -to add the header. Then finally call <code>sendHeaders()</code> and send the -content.</p> -<p><strong>Note:</strong> This is not required if your PHP config buffers all -output and your script doesn\'t do any incremental flushing of the output -buffer. PHP will generally set Content-Length for you if it can.</p> -<p>This script emulates a document that changes every ' .$every. ' seconds. -<br>This is version: ' . date('r', $lastModified) . '</p> -'; - -require '_include.php'; -$content = get_content(array( - 'title' => $title - ,'explain' => $explain -)); - -$cg->setContentLength(strlen($content)); -$cg->sendHeaders(); -send_slowly($content); - diff --git a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/3.php b/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/3.php deleted file mode 100644 index 8f5482ba8..000000000 --- a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/3.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../min/lib')); -require 'HTTP/ConditionalGet.php'; - -// generate content first (not ideal) -// emulate regularly updating document -$every = 20; -$lastModified = round(time()/$every)*$every - $every; -$title = 'Last-Modified is unknown : use hash of content for ETag'; -$explain = ' -<p>When Last-Modified is unknown, you can still use ETags, but you need a short -string that is unique for that content. In the worst case, you have to generate -all the content first, <em>then</em> instantiate HTTP_ConditionalGet, setting -the array key <code>contentHash</code> to the output of a hash function of the -content. Since we have the full content, we might as well also use -<code>setContentLength(strlen($content))</code> in the case where we need to -send it.</p> -<p>This script emulates a document that changes every ' .$every. ' seconds. -<br>This is version: ' . date('r', $lastModified) . '</p> -'; -require '_include.php'; -$content = get_content(array( - 'title' => $title - ,'explain' => $explain -)); - -$cg = new HTTP_ConditionalGet(array( - 'contentHash' => substr(md5($content), 7) -)); -if ($cg->cacheIsValid) { - $cg->sendHeaders(); - // we're done - exit(); -} -$cg->setContentLength(strlen($content)); -$cg->sendHeaders(); - -send_slowly($content); -
diff --git a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/4.php b/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/4.php deleted file mode 100644 index 4b77d2084..000000000 --- a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/4.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../min/lib')); -require 'HTTP/ConditionalGet.php'; - -// emulate regularly updating document -$every = 20; -$lastModified = round(time()/$every)*$every - $every; - -require 'HTTP/Encoder.php'; -list($enc,) = HTTP_Encoder::getAcceptedEncoding(); - -$cg = new HTTP_ConditionalGet(array( - 'lastModifiedTime' => $lastModified - ,'encoding' => $enc -)); -$cg->sendHeaders(); -if ($cg->cacheIsValid) { - // we're done - exit(); -} - -// output encoded content - -$title = 'ConditionalGet + Encoder'; -$explain = ' -<p>Using ConditionalGet and Encoder is straightforward. First impliment the -ConditionalGet, then if the cache is not valid, encode and send the content</p> -<p>This script emulates a document that changes every ' .$every. ' seconds. -<br>This is version: ' . date('r', $lastModified) . '</p> -'; -require '_include.php'; -$content = get_content(array( - 'title' => $title - ,'explain' => $explain -)); - -$he = new HTTP_Encoder(array( - 'content' => get_content(array( - 'title' => $title - ,'explain' => $explain - )) -)); -$he->encode(); - -// usually you would just $he->sendAll(), but here we want to emulate slow -// connection -$he->sendHeaders(); -send_slowly($he->getContent()); diff --git a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/5.php b/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/5.php deleted file mode 100644 index b443c1973..000000000 --- a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/5.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../min/lib')); -require 'HTTP/ConditionalGet.php'; - -// far expires -$cg = new HTTP_ConditionalGet(array( - 'maxAge' => 20 - ,'lastModifiedTime' => filemtime(__FILE__) -)); -$cg->sendHeaders(); - -// generate, send content -$title = 'Last-Modified + Expires'; -$explain = ' -<p>Here we set a static "lastModifiedTime" and "maxAge" to 20. The browser -will consider this document fresh for 20 seconds, then revalidate its cache. After -the 304 response, the cache will be good for another 20 seconds. Unless you force -a reload, there will only be 304 responses for this page after the initial download. -'; - -require '_include.php'; -echo get_content(array( - 'title' => $title - ,'explain' => $explain -)); - diff --git a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/_include.php b/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/_include.php deleted file mode 100644 index 9b65ae12e..000000000 --- a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/_include.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -function send_slowly($content) -{ - $half = ceil(strlen($content) / 2); - $content = str_split($content, $half); - while ($chunk = array_shift($content)) { - sleep(1); - echo $chunk; - ob_get_level() && ob_flush(); - flush(); - } -} - -function get_content($data) -{ - ob_start(); -?> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>HTTP_ConditionalGet : <?php echo $data['title']; ?></title> -</head> -<body> -<h1>HTTP_ConditionalGet</h1> -<h2><?php echo $data['title']; ?></h2> -<?php echo $data['explain']; ?> -<ul> - <li><a href="./">Last-Modified is known : simple usage</a></li> - <li><a href="2.php">Last-Modified is known : add Content-Length</a></li> - <li><a href="3.php">Last-Modified is unknown : use hash of content for ETag</a></li> - <li><a href="4.php">ConditionalGet + Encoder</a></li> - <li><a href="5.php">Last-Modified + Expires</a></li> -</ul> -<h2>Notes</h2> -<h3>How to distinguish 200 and 304 responses</h3> -<p>For these pages all 200 responses are sent in chunks a second apart, so you -should notice that 304 responses are quicker. You can also use HTTP sniffers -like <a href="http://www.fiddlertool.com/">Fiddler (win)</a> and -<a href="http://livehttpheaders.mozdev.org/">LiveHTTPHeaders (Firefox add-on)</a> -to verify headers and content being sent.</p> -<h3>Browser notes</h3> -<dl> - <dt>Opera</dt> - <dd>Opera has a couple behaviors against the HTTP spec: Manual refreshes (F5) - prevents the ETag/If-Modified-Since headers from being sent; it only sends - them when following a link or bookmark. Also, Opera will not honor the - <code>must-revalidate</code> Cache-Control value unless <code>max-age</code> - is set. To get Opera to follow the spec, ConditionalGet will send Opera max-age=0 - (if one is not already set).</dd> - <dt>Safari</dt> - <dd>ETag validation is unsupported, but Safari supports HTTP/1.0 validation via - If-Modified-Since headers as long as the cache is explicitly marked - "public" or "private" ("private" is default in ConditionalGet).</dd> -</dl> -</body> -</html> -<?php - $content = ob_get_contents(); - ob_end_clean(); - return $content; -} -
diff --git a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/index.php b/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/index.php deleted file mode 100644 index 0e4192e62..000000000 --- a/plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/index.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../min/lib')); -require 'HTTP/ConditionalGet.php'; - -// emulate regularly updating document -$every = 20; -$lastModified = round(time()/$every)*$every - $every; - -$cg = new HTTP_ConditionalGet(array( - 'lastModifiedTime' => $lastModified -)); -$cg->sendHeaders(); -if ($cg->cacheIsValid) { - // we're done - exit(); -} - -$title = 'Last-Modified is known : simple usage'; -$explain = ' -<p>If your content has not changed since a certain timestamp, set this via the -the <code>lastModifiedTime</code> array key when instantiating HTTP_ConditionalGet. -You can immediately call the method <code>sendHeaders()</code> to set the -Last-Modified, ETag, and Cache-Control headers. The, if <code>cacheIsValid</code> -property is false, you echo the content.</p> -<p>This script emulates a document that changes every ' .$every. ' seconds. -<br>This is version: ' . date('r', $lastModified) . '</p> -'; - -require '_include.php'; - -echo send_slowly(get_content(array( - 'title' => $title - ,'explain' => $explain -))); -
|