source: Dev/branches/rest-dojo-ui/server/tonic/features/steps/response.php @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 1.3 KB
Line 
1<?php
2
3$steps->Given('/^an accept encoding of "([^"]*)"$/', function($world, $arg1) {
4    $world->config['acceptEncoding'] = $arg1;
5});
6
7$steps->When('/^I process content encoding$/', function($world) {
8    $world->response->doContentEncoding();
9});
10
11$steps->Then('/^the response header "([^"]*)" should contain \'([^\']*)\'$/', function($world, $arg1, $arg2) {
12    if ($world->response->headers[$arg1] != $arg2) throw new Exception;
13});
14
15$steps->Then('/^the response body should be ([^ ]*) and be "([^"]*)"$/', function($world, $arg1, $arg2) {
16    switch ($arg1) {
17    case 'gzipped':
18        var_dump($world->response->body, $arg2, gzencode($arg2));
19        if ($world->response->body != gzencode($arg2)) throw new Exception;
20        break;
21    case 'deflated':
22        if ($world->response->body != gzdeflate($arg2)) throw new Exception;
23        break;
24    case 'compressed':
25        if ($world->response->body != gzcompress($arg2)) throw new Exception;
26        break;
27    }
28});
29
30$steps->Then('/^I add a cache header of "([^"]*)"$/', function($world, $arg1) {
31    if ($arg1 == '') {
32        $world->response->addCacheHeader();
33    } else {
34        $world->response->addCacheHeader($arg1);
35    }
36});
37
38$steps->Then('/^I add an etag header of "([^"]*)"$/', function($world, $arg1) {
39    $world->response->addEtag($arg1);
40});
41
Note: See TracBrowser for help on using the repository browser.