1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | var path = require( 'path' );
|
18 |
|
19 | var base = require( './base' );
|
20 | var handler = require( '../lib/handlers/php' );
|
21 |
|
22 | var zit = function() {
|
23 | return (process.env.USER === 'leeight' ? it : xit);
|
24 | }
|
25 |
|
26 | describe('php', function(){
|
27 | zit()('default', function(){
|
28 | var context = base.getContext();
|
29 | context.request.pathname = '/hello.php';
|
30 | context.request.url = '/hello.php?a=b';
|
31 | context.request.headers = {
|
32 | 'host': 'www.baidu.com'
|
33 | };
|
34 |
|
35 | spyOn( context, 'start' ).andCallFake( function(){
|
36 | runs(function(){
|
37 | expect( context.start ).toHaveBeenCalled();
|
38 | expect( context.start.callCount ).toBe( 1 );
|
39 | expect( context.content.indexOf( '<title>phpinfo()</title>' ) ).not.toBe( -1 );
|
40 | expect( context.content.indexOf( '</html>' ) ).not.toBe( -1 );
|
41 | });
|
42 | } );
|
43 |
|
44 | handler()( context );
|
45 |
|
46 | waitsFor(function(){ return context.start.callCount === 1 }, 'x', 1000)
|
47 | });
|
48 | });
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|