@@ -11,92 +11,92 @@ discard block |
||
11 | 11 | public static $app=null; |
12 | 12 | |
13 | 13 | public function setUp () { |
14 | - if (self::$app===null) self::$app=new TApplication(dirname(__FILE__).'/app'); |
|
15 | - ob_start(); |
|
14 | + if (self::$app===null) self::$app=new TApplication(dirname(__FILE__).'/app'); |
|
15 | + ob_start(); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | public function tearDown () { |
19 | - ob_end_flush(); |
|
19 | + ob_end_flush(); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function testInit() { |
23 | - $response=new THttpResponse (); |
|
24 | - $response->init (null); |
|
25 | - self::assertEquals ($response, self::$app->getResponse()); |
|
23 | + $response=new THttpResponse (); |
|
24 | + $response->init (null); |
|
25 | + self::assertEquals ($response, self::$app->getResponse()); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function testSetCacheExpire() { |
29 | - $response=new THttpResponse (); |
|
30 | - $response->init (null); |
|
31 | - $response->setCacheExpire (300); |
|
32 | - self::assertEquals(300, $response->getCacheExpire()); |
|
29 | + $response=new THttpResponse (); |
|
30 | + $response->init (null); |
|
31 | + $response->setCacheExpire (300); |
|
32 | + self::assertEquals(300, $response->getCacheExpire()); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | public function testSetCacheControl() { |
36 | - $response=new THttpResponse (); |
|
37 | - $response->init (null); |
|
38 | - foreach (array ('none','nocache','private','private_no_expire','public') as $cc) { |
|
39 | - $response->setCacheControl($cc); |
|
40 | - self::assertEquals($cc, $response->getCacheControl()); |
|
41 | - } |
|
42 | - try { |
|
43 | - $response->setCacheControl('invalid'); |
|
44 | - self::fail ('Expected TInvalidDataValueException not thrown'); |
|
45 | - } catch (TInvalidDataValueException $e) {} |
|
36 | + $response=new THttpResponse (); |
|
37 | + $response->init (null); |
|
38 | + foreach (array ('none','nocache','private','private_no_expire','public') as $cc) { |
|
39 | + $response->setCacheControl($cc); |
|
40 | + self::assertEquals($cc, $response->getCacheControl()); |
|
41 | + } |
|
42 | + try { |
|
43 | + $response->setCacheControl('invalid'); |
|
44 | + self::fail ('Expected TInvalidDataValueException not thrown'); |
|
45 | + } catch (TInvalidDataValueException $e) {} |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
49 | 49 | public function testSetContentType() { |
50 | - $response=new THttpResponse (); |
|
51 | - $response->init (null); |
|
52 | - $response->setContentType('image/jpeg'); |
|
53 | - self::assertEquals('image/jpeg', $response->getContentType()); |
|
54 | - $response->setContentType('text/plain'); |
|
55 | - self::assertEquals('text/plain', $response->getContentType()); |
|
50 | + $response=new THttpResponse (); |
|
51 | + $response->init (null); |
|
52 | + $response->setContentType('image/jpeg'); |
|
53 | + self::assertEquals('image/jpeg', $response->getContentType()); |
|
54 | + $response->setContentType('text/plain'); |
|
55 | + self::assertEquals('text/plain', $response->getContentType()); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | public function testSetCharset() { |
59 | - $response=new THttpResponse (); |
|
60 | - $response->init (null); |
|
61 | - $response->setCharset ('UTF-8'); |
|
62 | - self::assertEquals('UTF-8', $response->getCharset()); |
|
63 | - $response->setCharset ('ISO8859-1'); |
|
64 | - self::assertEquals('ISO8859-1', $response->getCharset()); |
|
59 | + $response=new THttpResponse (); |
|
60 | + $response->init (null); |
|
61 | + $response->setCharset ('UTF-8'); |
|
62 | + self::assertEquals('UTF-8', $response->getCharset()); |
|
63 | + $response->setCharset ('ISO8859-1'); |
|
64 | + self::assertEquals('ISO8859-1', $response->getCharset()); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
68 | 68 | public function testSetBufferOutput() { |
69 | - $response=new THttpResponse (); |
|
70 | - $response->setBufferOutput(true); |
|
71 | - self::assertTrue($response->getBufferOutput()); |
|
72 | - $response->init (null); |
|
73 | - try { |
|
74 | - $response->setBufferOutput(false); |
|
75 | - self::fail ('Expected TInvalidOperationException not thrown'); |
|
76 | - } catch (TInvalidOperationException $e) {} |
|
69 | + $response=new THttpResponse (); |
|
70 | + $response->setBufferOutput(true); |
|
71 | + self::assertTrue($response->getBufferOutput()); |
|
72 | + $response->init (null); |
|
73 | + try { |
|
74 | + $response->setBufferOutput(false); |
|
75 | + self::fail ('Expected TInvalidOperationException not thrown'); |
|
76 | + } catch (TInvalidOperationException $e) {} |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public function testSetStatusCode() { |
80 | - $response=new THttpResponse (); |
|
81 | - $response->init (null); |
|
82 | - $response->setStatusCode(401); |
|
83 | - self::assertEquals(401, $response->getStatusCode()); |
|
84 | - $response->setStatusCode(200); |
|
85 | - self::assertEquals(200, $response->getStatusCode()); |
|
80 | + $response=new THttpResponse (); |
|
81 | + $response->init (null); |
|
82 | + $response->setStatusCode(401); |
|
83 | + self::assertEquals(401, $response->getStatusCode()); |
|
84 | + $response->setStatusCode(200); |
|
85 | + self::assertEquals(200, $response->getStatusCode()); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | public function testGetCookies() { |
89 | - $response=new THttpResponse (); |
|
90 | - $response->init (null); |
|
91 | - self::assertInstanceOf('THttpCookieCollection', $response->getCookies()); |
|
92 | - self::assertEquals(0, $response->getCookies()->getCount()); |
|
89 | + $response=new THttpResponse (); |
|
90 | + $response->init (null); |
|
91 | + self::assertInstanceOf('THttpCookieCollection', $response->getCookies()); |
|
92 | + self::assertEquals(0, $response->getCookies()->getCount()); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | public function testWrite() { |
96 | - $response=new THttpResponse (); |
|
96 | + $response=new THttpResponse (); |
|
97 | 97 | //self::expectOutputString("test string"); |
98 | - $response->write("test string"); |
|
99 | - self::assertContains ('test string', ob_get_clean()); |
|
98 | + $response->write("test string"); |
|
99 | + self::assertContains ('test string', ob_get_clean()); |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | |
@@ -105,56 +105,56 @@ discard block |
||
105 | 105 | // Don't know how to test headers :(( ... |
106 | 106 | throw new PHPUnit_Framework_IncompleteTestError(); |
107 | 107 | |
108 | - $response=new THttpResponse (); |
|
109 | - $response->setBufferOutput(true); |
|
110 | - // Suppress warning with headers |
|
111 | - $response->writeFile(dirname(__FILE__).'/data/aTarFile.md5', null, 'text/plain', array ('Pragma: public', 'Expires: 0')); |
|
108 | + $response=new THttpResponse (); |
|
109 | + $response->setBufferOutput(true); |
|
110 | + // Suppress warning with headers |
|
111 | + $response->writeFile(dirname(__FILE__).'/data/aTarFile.md5', null, 'text/plain', array ('Pragma: public', 'Expires: 0')); |
|
112 | 112 | |
113 | - self::assertContains('4b1ecb0b243918a8bbfbb4515937be98 aTarFile.tar', ob_get_clean()); |
|
113 | + self::assertContains('4b1ecb0b243918a8bbfbb4515937be98 aTarFile.tar', ob_get_clean()); |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | 117 | public function testRedirect() { |
118 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
118 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | public function testReload() { |
122 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
122 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | public function testFlush() { |
126 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
126 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | public function testSendContentTypeHeader() { |
130 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
130 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function testClear() { |
134 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
134 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | public function testAppendHeader() { |
138 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
138 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | public function testAppendLog() { |
142 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
142 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | public function testAddCookie() { |
146 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
146 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | public function testRemoveCookie() { |
150 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
150 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | public function testSetHtmlWriterType() { |
154 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
154 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | public function testCreateHtmlWriter() { |
158 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
158 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | \ No newline at end of file |
@@ -8,47 +8,47 @@ discard block |
||
8 | 8 | */ |
9 | 9 | class THttpResponseTest extends PHPUnit_Framework_TestCase { |
10 | 10 | |
11 | - public static $app=null; |
|
11 | + public static $app = null; |
|
12 | 12 | |
13 | - public function setUp () { |
|
14 | - if (self::$app===null) self::$app=new TApplication(dirname(__FILE__).'/app'); |
|
13 | + public function setUp() { |
|
14 | + if (self::$app === null) self::$app = new TApplication(dirname(__FILE__) . '/app'); |
|
15 | 15 | ob_start(); |
16 | 16 | } |
17 | 17 | |
18 | - public function tearDown () { |
|
18 | + public function tearDown() { |
|
19 | 19 | ob_end_flush(); |
20 | 20 | } |
21 | 21 | |
22 | 22 | public function testInit() { |
23 | - $response=new THttpResponse (); |
|
24 | - $response->init (null); |
|
25 | - self::assertEquals ($response, self::$app->getResponse()); |
|
23 | + $response = new THttpResponse(); |
|
24 | + $response->init(null); |
|
25 | + self::assertEquals($response, self::$app->getResponse()); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function testSetCacheExpire() { |
29 | - $response=new THttpResponse (); |
|
30 | - $response->init (null); |
|
31 | - $response->setCacheExpire (300); |
|
29 | + $response = new THttpResponse(); |
|
30 | + $response->init(null); |
|
31 | + $response->setCacheExpire(300); |
|
32 | 32 | self::assertEquals(300, $response->getCacheExpire()); |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function testSetCacheControl() { |
36 | - $response=new THttpResponse (); |
|
37 | - $response->init (null); |
|
38 | - foreach (array ('none','nocache','private','private_no_expire','public') as $cc) { |
|
36 | + $response = new THttpResponse(); |
|
37 | + $response->init(null); |
|
38 | + foreach (array('none', 'nocache', 'private', 'private_no_expire', 'public') as $cc) { |
|
39 | 39 | $response->setCacheControl($cc); |
40 | 40 | self::assertEquals($cc, $response->getCacheControl()); |
41 | 41 | } |
42 | 42 | try { |
43 | 43 | $response->setCacheControl('invalid'); |
44 | - self::fail ('Expected TInvalidDataValueException not thrown'); |
|
44 | + self::fail('Expected TInvalidDataValueException not thrown'); |
|
45 | 45 | } catch (TInvalidDataValueException $e) {} |
46 | 46 | |
47 | 47 | } |
48 | 48 | |
49 | 49 | public function testSetContentType() { |
50 | - $response=new THttpResponse (); |
|
51 | - $response->init (null); |
|
50 | + $response = new THttpResponse(); |
|
51 | + $response->init(null); |
|
52 | 52 | $response->setContentType('image/jpeg'); |
53 | 53 | self::assertEquals('image/jpeg', $response->getContentType()); |
54 | 54 | $response->setContentType('text/plain'); |
@@ -56,29 +56,29 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function testSetCharset() { |
59 | - $response=new THttpResponse (); |
|
60 | - $response->init (null); |
|
61 | - $response->setCharset ('UTF-8'); |
|
59 | + $response = new THttpResponse(); |
|
60 | + $response->init(null); |
|
61 | + $response->setCharset('UTF-8'); |
|
62 | 62 | self::assertEquals('UTF-8', $response->getCharset()); |
63 | - $response->setCharset ('ISO8859-1'); |
|
63 | + $response->setCharset('ISO8859-1'); |
|
64 | 64 | self::assertEquals('ISO8859-1', $response->getCharset()); |
65 | 65 | |
66 | 66 | } |
67 | 67 | |
68 | 68 | public function testSetBufferOutput() { |
69 | - $response=new THttpResponse (); |
|
69 | + $response = new THttpResponse(); |
|
70 | 70 | $response->setBufferOutput(true); |
71 | 71 | self::assertTrue($response->getBufferOutput()); |
72 | - $response->init (null); |
|
72 | + $response->init(null); |
|
73 | 73 | try { |
74 | 74 | $response->setBufferOutput(false); |
75 | - self::fail ('Expected TInvalidOperationException not thrown'); |
|
75 | + self::fail('Expected TInvalidOperationException not thrown'); |
|
76 | 76 | } catch (TInvalidOperationException $e) {} |
77 | 77 | } |
78 | 78 | |
79 | 79 | public function testSetStatusCode() { |
80 | - $response=new THttpResponse (); |
|
81 | - $response->init (null); |
|
80 | + $response = new THttpResponse(); |
|
81 | + $response->init(null); |
|
82 | 82 | $response->setStatusCode(401); |
83 | 83 | self::assertEquals(401, $response->getStatusCode()); |
84 | 84 | $response->setStatusCode(200); |
@@ -86,17 +86,17 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | public function testGetCookies() { |
89 | - $response=new THttpResponse (); |
|
90 | - $response->init (null); |
|
89 | + $response = new THttpResponse(); |
|
90 | + $response->init(null); |
|
91 | 91 | self::assertInstanceOf('THttpCookieCollection', $response->getCookies()); |
92 | 92 | self::assertEquals(0, $response->getCookies()->getCount()); |
93 | 93 | } |
94 | 94 | |
95 | 95 | public function testWrite() { |
96 | - $response=new THttpResponse (); |
|
96 | + $response = new THttpResponse(); |
|
97 | 97 | //self::expectOutputString("test string"); |
98 | 98 | $response->write("test string"); |
99 | - self::assertContains ('test string', ob_get_clean()); |
|
99 | + self::assertContains('test string', ob_get_clean()); |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | // Don't know how to test headers :(( ... |
106 | 106 | throw new PHPUnit_Framework_IncompleteTestError(); |
107 | 107 | |
108 | - $response=new THttpResponse (); |
|
108 | + $response = new THttpResponse(); |
|
109 | 109 | $response->setBufferOutput(true); |
110 | 110 | // Suppress warning with headers |
111 | - $response->writeFile(dirname(__FILE__).'/data/aTarFile.md5', null, 'text/plain', array ('Pragma: public', 'Expires: 0')); |
|
111 | + $response->writeFile(dirname(__FILE__) . '/data/aTarFile.md5', null, 'text/plain', array('Pragma: public', 'Expires: 0')); |
|
112 | 112 | |
113 | 113 | self::assertContains('4b1ecb0b243918a8bbfbb4515937be98 aTarFile.tar', ob_get_clean()); |
114 | 114 |
@@ -11,7 +11,9 @@ |
||
11 | 11 | public static $app=null; |
12 | 12 | |
13 | 13 | public function setUp () { |
14 | - if (self::$app===null) self::$app=new TApplication(dirname(__FILE__).'/app'); |
|
14 | + if (self::$app===null) { |
|
15 | + self::$app=new TApplication(dirname(__FILE__).'/app'); |
|
16 | + } |
|
15 | 17 | ob_start(); |
16 | 18 | } |
17 | 19 |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | */ |
9 | 9 | class TCacheHttpSessionTest extends PHPUnit_Framework_TestCase |
10 | 10 | { |
11 | - protected $app = null; |
|
11 | + protected $app = null; |
|
12 | 12 | protected static $cache = null; |
13 | 13 | protected static $session = null; |
14 | 14 | |
15 | - protected function setUp() |
|
16 | - { |
|
15 | + protected function setUp() |
|
16 | + { |
|
17 | 17 | if(!extension_loaded('memcache')) |
18 | 18 | { |
19 | 19 | self::markTestSkipped('The memcache extension is not available'); |
@@ -35,74 +35,74 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | protected function tearDown() |
38 | - { |
|
38 | + { |
|
39 | 39 | $this->app = null; |
40 | 40 | $this->cache = null; |
41 | 41 | $this->session = null; |
42 | 42 | } |
43 | 43 | |
44 | - public function testInit() |
|
45 | - { |
|
46 | - $session = new TCacheHttpSession(); |
|
47 | - try |
|
48 | - { |
|
49 | - $session->init(null); |
|
50 | - $this->fail("Expected TConfigurationException is not raised"); |
|
51 | - } |
|
52 | - catch(TConfigurationException $e) |
|
53 | - { |
|
54 | - } |
|
55 | - unset($session); |
|
44 | + public function testInit() |
|
45 | + { |
|
46 | + $session = new TCacheHttpSession(); |
|
47 | + try |
|
48 | + { |
|
49 | + $session->init(null); |
|
50 | + $this->fail("Expected TConfigurationException is not raised"); |
|
51 | + } |
|
52 | + catch(TConfigurationException $e) |
|
53 | + { |
|
54 | + } |
|
55 | + unset($session); |
|
56 | 56 | |
57 | - $session = new TCacheHttpSession(); |
|
58 | - try |
|
59 | - { |
|
60 | - $session->setCacheModuleID('MaiCache'); |
|
61 | - $session->init(null); |
|
62 | - $this->fail("Expected TConfigurationException is not raised"); |
|
63 | - $session->open(); |
|
64 | - } |
|
65 | - catch(TConfigurationException $e) |
|
66 | - { |
|
67 | - } |
|
68 | - unset($session); |
|
57 | + $session = new TCacheHttpSession(); |
|
58 | + try |
|
59 | + { |
|
60 | + $session->setCacheModuleID('MaiCache'); |
|
61 | + $session->init(null); |
|
62 | + $this->fail("Expected TConfigurationException is not raised"); |
|
63 | + $session->open(); |
|
64 | + } |
|
65 | + catch(TConfigurationException $e) |
|
66 | + { |
|
67 | + } |
|
68 | + unset($session); |
|
69 | 69 | |
70 | - self::$session = new TCacheHttpSession(); |
|
71 | - try |
|
72 | - { |
|
73 | - self::$session->setCacheModuleID('MyCache'); |
|
74 | - self::$session->init(null); |
|
75 | - } |
|
76 | - catch(TConfigurationException $e) |
|
77 | - { |
|
78 | - $this->fail('TConfigurationException is not expected'); |
|
79 | - self::markTestSkipped('Cannot continue this test'); |
|
80 | - } |
|
81 | - } |
|
70 | + self::$session = new TCacheHttpSession(); |
|
71 | + try |
|
72 | + { |
|
73 | + self::$session->setCacheModuleID('MyCache'); |
|
74 | + self::$session->init(null); |
|
75 | + } |
|
76 | + catch(TConfigurationException $e) |
|
77 | + { |
|
78 | + $this->fail('TConfigurationException is not expected'); |
|
79 | + self::markTestSkipped('Cannot continue this test'); |
|
80 | + } |
|
81 | + } |
|
82 | 82 | |
83 | - public function testGetCache() |
|
84 | - { |
|
85 | - $cache = self::$session->getCache(); |
|
86 | - $this->assertEquals(true, $cache instanceof TMemCache); |
|
87 | - } |
|
83 | + public function testGetCache() |
|
84 | + { |
|
85 | + $cache = self::$session->getCache(); |
|
86 | + $this->assertEquals(true, $cache instanceof TMemCache); |
|
87 | + } |
|
88 | 88 | |
89 | - public function testCacheModuleID() |
|
90 | - { |
|
91 | - $id = 'value'; |
|
92 | - self::$session->setCacheModuleID($id); |
|
93 | - self::assertEquals($id, self::$session->getCacheModuleID()); |
|
94 | - } |
|
89 | + public function testCacheModuleID() |
|
90 | + { |
|
91 | + $id = 'value'; |
|
92 | + self::$session->setCacheModuleID($id); |
|
93 | + self::assertEquals($id, self::$session->getCacheModuleID()); |
|
94 | + } |
|
95 | 95 | |
96 | - public function testKeyPrefix() |
|
97 | - { |
|
98 | - $id = 'value'; |
|
99 | - self::$session->setKeyPrefix($id); |
|
100 | - self::assertEquals($id, self::$session->getKeyPrefix()); |
|
101 | - } |
|
96 | + public function testKeyPrefix() |
|
97 | + { |
|
98 | + $id = 'value'; |
|
99 | + self::$session->setKeyPrefix($id); |
|
100 | + self::assertEquals($id, self::$session->getKeyPrefix()); |
|
101 | + } |
|
102 | 102 | |
103 | - public function testSetAndGet() |
|
104 | - { |
|
105 | - self::$session['key'] = 'value'; |
|
103 | + public function testSetAndGet() |
|
104 | + { |
|
105 | + self::$session['key'] = 'value'; |
|
106 | 106 | self::assertEquals('value', self::$session['key']); |
107 | 107 | } |
108 | 108 |
@@ -14,15 +14,15 @@ discard block |
||
14 | 14 | |
15 | 15 | protected function setUp() |
16 | 16 | { |
17 | - if(!extension_loaded('memcache')) |
|
17 | + if (!extension_loaded('memcache')) |
|
18 | 18 | { |
19 | 19 | self::markTestSkipped('The memcache extension is not available'); |
20 | 20 | } |
21 | 21 | else |
22 | 22 | { |
23 | - $basePath = dirname(__FILE__).'/app'; |
|
24 | - $runtimePath = $basePath.'/runtime'; |
|
25 | - if(!is_writable($runtimePath)) |
|
23 | + $basePath = dirname(__FILE__) . '/app'; |
|
24 | + $runtimePath = $basePath . '/runtime'; |
|
25 | + if (!is_writable($runtimePath)) |
|
26 | 26 | { |
27 | 27 | self::markTestSkipped("'$runtimePath' is not writable"); |
28 | 28 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | self::$cache = new TMemCache(); |
31 | 31 | self::$cache->setKeyPrefix('MyCache'); |
32 | 32 | self::$cache->init(null); |
33 | - $this->app->setModule('MyCache',self::$cache); |
|
33 | + $this->app->setModule('MyCache', self::$cache); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $session->init(null); |
50 | 50 | $this->fail("Expected TConfigurationException is not raised"); |
51 | 51 | } |
52 | - catch(TConfigurationException $e) |
|
52 | + catch (TConfigurationException $e) |
|
53 | 53 | { |
54 | 54 | } |
55 | 55 | unset($session); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->fail("Expected TConfigurationException is not raised"); |
63 | 63 | $session->open(); |
64 | 64 | } |
65 | - catch(TConfigurationException $e) |
|
65 | + catch (TConfigurationException $e) |
|
66 | 66 | { |
67 | 67 | } |
68 | 68 | unset($session); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | self::$session->setCacheModuleID('MyCache'); |
74 | 74 | self::$session->init(null); |
75 | 75 | } |
76 | - catch(TConfigurationException $e) |
|
76 | + catch (TConfigurationException $e) |
|
77 | 77 | { |
78 | 78 | $this->fail('TConfigurationException is not expected'); |
79 | 79 | self::markTestSkipped('Cannot continue this test'); |
@@ -17,8 +17,7 @@ discard block |
||
17 | 17 | if(!extension_loaded('memcache')) |
18 | 18 | { |
19 | 19 | self::markTestSkipped('The memcache extension is not available'); |
20 | - } |
|
21 | - else |
|
20 | + } else |
|
22 | 21 | { |
23 | 22 | $basePath = dirname(__FILE__).'/app'; |
24 | 23 | $runtimePath = $basePath.'/runtime'; |
@@ -48,8 +47,7 @@ discard block |
||
48 | 47 | { |
49 | 48 | $session->init(null); |
50 | 49 | $this->fail("Expected TConfigurationException is not raised"); |
51 | - } |
|
52 | - catch(TConfigurationException $e) |
|
50 | + } catch(TConfigurationException $e) |
|
53 | 51 | { |
54 | 52 | } |
55 | 53 | unset($session); |
@@ -61,8 +59,7 @@ discard block |
||
61 | 59 | $session->init(null); |
62 | 60 | $this->fail("Expected TConfigurationException is not raised"); |
63 | 61 | $session->open(); |
64 | - } |
|
65 | - catch(TConfigurationException $e) |
|
62 | + } catch(TConfigurationException $e) |
|
66 | 63 | { |
67 | 64 | } |
68 | 65 | unset($session); |
@@ -72,8 +69,7 @@ discard block |
||
72 | 69 | { |
73 | 70 | self::$session->setCacheModuleID('MyCache'); |
74 | 71 | self::$session->init(null); |
75 | - } |
|
76 | - catch(TConfigurationException $e) |
|
72 | + } catch(TConfigurationException $e) |
|
77 | 73 | { |
78 | 74 | $this->fail('TConfigurationException is not expected'); |
79 | 75 | self::markTestSkipped('Cannot continue this test'); |
@@ -15,114 +15,114 @@ |
||
15 | 15 | private $transformPath; |
16 | 16 | |
17 | 17 | public function setUp() { |
18 | - $this->documentPath = dirname(__FILE__).'/data/hello.xml'; |
|
19 | - $this->documentContent = file_get_contents($this->documentPath); |
|
20 | - $this->transformPath = dirname(__FILE__).'/data/hello.xsl'; |
|
21 | - $this->transformContent = file_get_contents($this->transformPath); |
|
18 | + $this->documentPath = dirname(__FILE__).'/data/hello.xml'; |
|
19 | + $this->documentContent = file_get_contents($this->documentPath); |
|
20 | + $this->transformPath = dirname(__FILE__).'/data/hello.xsl'; |
|
21 | + $this->transformContent = file_get_contents($this->transformPath); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function testSetDocumentContent() { |
25 | - $expected = $this->documentContent; |
|
26 | - $transform = new TXmlTransform(); |
|
27 | - $transform->setDocumentContent($expected); |
|
28 | - $this->assertEquals($expected, $transform->getDocumentContent()); |
|
25 | + $expected = $this->documentContent; |
|
26 | + $transform = new TXmlTransform(); |
|
27 | + $transform->setDocumentContent($expected); |
|
28 | + $this->assertEquals($expected, $transform->getDocumentContent()); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | public function testSetDocumentPathAsFile() { |
32 | - $expected = $this->documentPath; |
|
33 | - $transform = new TXmlTransform(); |
|
34 | - $transform->setDocumentPath($expected); |
|
35 | - $this->assertEquals($expected, $transform->getDocumentPath()); |
|
32 | + $expected = $this->documentPath; |
|
33 | + $transform = new TXmlTransform(); |
|
34 | + $transform->setDocumentPath($expected); |
|
35 | + $this->assertEquals($expected, $transform->getDocumentPath()); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function testSetDocumentPathAsNamespace() { |
39 | - if(Prado::getPathOfAlias('UnitTest') === null) { |
|
40 | - Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data'); |
|
41 | - } |
|
42 | - $expected = $this->documentPath; |
|
43 | - $transform = new TXmlTransform(); |
|
44 | - $transform->setDocumentPath('UnitTest.hello'); |
|
45 | - $this->assertEquals($expected, $transform->getDocumentPath()); |
|
39 | + if(Prado::getPathOfAlias('UnitTest') === null) { |
|
40 | + Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data'); |
|
41 | + } |
|
42 | + $expected = $this->documentPath; |
|
43 | + $transform = new TXmlTransform(); |
|
44 | + $transform->setDocumentPath('UnitTest.hello'); |
|
45 | + $this->assertEquals($expected, $transform->getDocumentPath()); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function testSetTransformContent() { |
49 | - $expected = $this->transformContent; |
|
50 | - $transform = new TXmlTransform(); |
|
51 | - $transform->setTransformContent($expected); |
|
52 | - $this->assertEquals($expected, $transform->getTransformContent()); |
|
49 | + $expected = $this->transformContent; |
|
50 | + $transform = new TXmlTransform(); |
|
51 | + $transform->setTransformContent($expected); |
|
52 | + $this->assertEquals($expected, $transform->getTransformContent()); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function testSetTransformPathAsFile() { |
56 | - $expected = $this->transformPath; |
|
57 | - $transform = new TXmlTransform(); |
|
58 | - $transform->setTransformPath($expected); |
|
59 | - $this->assertEquals($expected, $transform->getTransformPath()); |
|
56 | + $expected = $this->transformPath; |
|
57 | + $transform = new TXmlTransform(); |
|
58 | + $transform->setTransformPath($expected); |
|
59 | + $this->assertEquals($expected, $transform->getTransformPath()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | public function testSetTransformPathAsNamespace() { |
63 | - if(Prado::getPathOfAlias('UnitTest') === null) { |
|
64 | - Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data'); |
|
65 | - } |
|
66 | - $expected = $this->transformPath; |
|
67 | - $transform = new TXmlTransform(); |
|
68 | - $transform->setTransformPath('UnitTest.hello'); |
|
69 | - $this->assertEquals($expected, $transform->getTransformPath()); |
|
63 | + if(Prado::getPathOfAlias('UnitTest') === null) { |
|
64 | + Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data'); |
|
65 | + } |
|
66 | + $expected = $this->transformPath; |
|
67 | + $transform = new TXmlTransform(); |
|
68 | + $transform->setTransformPath('UnitTest.hello'); |
|
69 | + $this->assertEquals($expected, $transform->getTransformPath()); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | public function testAddParameter() { |
73 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
73 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | public function testRenderWithDocumentContentAndTransformContent() { |
77 | - $expected = "<b>Hello World!</b>\n"; |
|
78 | - $transform = new TXmlTransform(); |
|
79 | - $transform->setDocumentContent($this->documentContent); |
|
80 | - $transform->setTransformContent($this->transformContent); |
|
81 | - $textWriter = new TTextWriter(); |
|
82 | - $htmlWriter = new THtmlWriter($textWriter); |
|
83 | - $transform->render($htmlWriter); |
|
84 | - $actual = $textWriter->flush(); |
|
85 | - self::assertEquals($expected, $actual); |
|
77 | + $expected = "<b>Hello World!</b>\n"; |
|
78 | + $transform = new TXmlTransform(); |
|
79 | + $transform->setDocumentContent($this->documentContent); |
|
80 | + $transform->setTransformContent($this->transformContent); |
|
81 | + $textWriter = new TTextWriter(); |
|
82 | + $htmlWriter = new THtmlWriter($textWriter); |
|
83 | + $transform->render($htmlWriter); |
|
84 | + $actual = $textWriter->flush(); |
|
85 | + self::assertEquals($expected, $actual); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | public function testRenderWithDocumentPathAndTransformContent() { |
89 | - $expected = "<b>Hello World!</b>\n"; |
|
90 | - $transform = new TXmlTransform(); |
|
91 | - $transform->setDocumentPath($this->documentPath); |
|
92 | - $transform->setTransformContent($this->transformContent); |
|
93 | - $textWriter = new TTextWriter(); |
|
94 | - $htmlWriter = new THtmlWriter($textWriter); |
|
95 | - $transform->render($htmlWriter); |
|
96 | - $actual = $textWriter->flush(); |
|
97 | - self::assertEquals($expected, $actual); |
|
89 | + $expected = "<b>Hello World!</b>\n"; |
|
90 | + $transform = new TXmlTransform(); |
|
91 | + $transform->setDocumentPath($this->documentPath); |
|
92 | + $transform->setTransformContent($this->transformContent); |
|
93 | + $textWriter = new TTextWriter(); |
|
94 | + $htmlWriter = new THtmlWriter($textWriter); |
|
95 | + $transform->render($htmlWriter); |
|
96 | + $actual = $textWriter->flush(); |
|
97 | + self::assertEquals($expected, $actual); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | public function testRenderWithDocumentContentAndTransformPath() { |
101 | - $expected = "<b>Hello World!</b>\n"; |
|
102 | - $transform = new TXmlTransform(); |
|
103 | - $transform->setDocumentContent($this->documentContent); |
|
104 | - $transform->setTransformPath($this->transformPath); |
|
105 | - $textWriter = new TTextWriter(); |
|
106 | - $htmlWriter = new THtmlWriter($textWriter); |
|
107 | - $transform->render($htmlWriter); |
|
108 | - $actual = $textWriter->flush(); |
|
109 | - self::assertEquals($expected, $actual); |
|
101 | + $expected = "<b>Hello World!</b>\n"; |
|
102 | + $transform = new TXmlTransform(); |
|
103 | + $transform->setDocumentContent($this->documentContent); |
|
104 | + $transform->setTransformPath($this->transformPath); |
|
105 | + $textWriter = new TTextWriter(); |
|
106 | + $htmlWriter = new THtmlWriter($textWriter); |
|
107 | + $transform->render($htmlWriter); |
|
108 | + $actual = $textWriter->flush(); |
|
109 | + self::assertEquals($expected, $actual); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | public function testRenderWithDocumentPathAndTransformPath() { |
113 | - $expected = "<b>Hello World!</b>\n"; |
|
114 | - $transform = new TXmlTransform(); |
|
115 | - $transform->setDocumentPath($this->documentPath); |
|
116 | - $transform->setTransformPath($this->transformPath); |
|
117 | - $textWriter = new TTextWriter(); |
|
118 | - $htmlWriter = new THtmlWriter($textWriter); |
|
119 | - $transform->render($htmlWriter); |
|
120 | - $actual = $textWriter->flush(); |
|
121 | - self::assertEquals($expected, $actual); |
|
113 | + $expected = "<b>Hello World!</b>\n"; |
|
114 | + $transform = new TXmlTransform(); |
|
115 | + $transform->setDocumentPath($this->documentPath); |
|
116 | + $transform->setTransformPath($this->transformPath); |
|
117 | + $textWriter = new TTextWriter(); |
|
118 | + $htmlWriter = new THtmlWriter($textWriter); |
|
119 | + $transform->render($htmlWriter); |
|
120 | + $actual = $textWriter->flush(); |
|
121 | + self::assertEquals($expected, $actual); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | public function testRenderWithBodyAsDocumentAndTransformPath() { |
125 | - throw new PHPUnit_Framework_IncompleteTestError(); |
|
125 | + throw new PHPUnit_Framework_IncompleteTestError(); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | private $transformPath; |
16 | 16 | |
17 | 17 | public function setUp() { |
18 | - $this->documentPath = dirname(__FILE__).'/data/hello.xml'; |
|
18 | + $this->documentPath = dirname(__FILE__) . '/data/hello.xml'; |
|
19 | 19 | $this->documentContent = file_get_contents($this->documentPath); |
20 | - $this->transformPath = dirname(__FILE__).'/data/hello.xsl'; |
|
20 | + $this->transformPath = dirname(__FILE__) . '/data/hello.xsl'; |
|
21 | 21 | $this->transformContent = file_get_contents($this->transformPath); |
22 | 22 | } |
23 | 23 | |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | public function testSetDocumentPathAsNamespace() { |
39 | - if(Prado::getPathOfAlias('UnitTest') === null) { |
|
40 | - Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data'); |
|
39 | + if (Prado::getPathOfAlias('UnitTest') === null) { |
|
40 | + Prado::setPathOfAlias('UnitTest', dirname(__FILE__) . '/data'); |
|
41 | 41 | } |
42 | 42 | $expected = $this->documentPath; |
43 | 43 | $transform = new TXmlTransform(); |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | public function testSetTransformPathAsNamespace() { |
63 | - if(Prado::getPathOfAlias('UnitTest') === null) { |
|
64 | - Prado::setPathOfAlias('UnitTest', dirname(__FILE__).'/data'); |
|
63 | + if (Prado::getPathOfAlias('UnitTest') === null) { |
|
64 | + Prado::setPathOfAlias('UnitTest', dirname(__FILE__) . '/data'); |
|
65 | 65 | } |
66 | 66 | $expected = $this->transformPath; |
67 | 67 | $transform = new TXmlTransform(); |
@@ -10,8 +10,8 @@ |
||
10 | 10 | class TLabelTest extends PHPUnit_Framework_TestCase { |
11 | 11 | |
12 | 12 | public function testSetText() { |
13 | - $label = new TLabel(); |
|
14 | - $label->setText('Test'); |
|
15 | - $this->assertEquals('Test', $label->getText()); |
|
13 | + $label = new TLabel(); |
|
14 | + $label->setText('Test'); |
|
15 | + $this->assertEquals('Test', $label->getText()); |
|
16 | 16 | } |
17 | 17 | } |
@@ -9,13 +9,13 @@ |
||
9 | 9 | class TRequiredFieldValidatorTest extends PHPUnit_Framework_TestCase { |
10 | 10 | |
11 | 11 | public function testGetEmptyInitialValue() { |
12 | - $validator = new TRequiredFieldValidator(); |
|
13 | - try { |
|
14 | - $value = $validator->getInitialValue(); |
|
15 | - } catch (TConfigurationException $e) { |
|
16 | - //since prado 3.2.2 you need to set at least ControlToValidate |
|
17 | - $value = ''; |
|
18 | - } |
|
19 | - $this->assertEquals('', $value); |
|
12 | + $validator = new TRequiredFieldValidator(); |
|
13 | + try { |
|
14 | + $value = $validator->getInitialValue(); |
|
15 | + } catch (TConfigurationException $e) { |
|
16 | + //since prado 3.2.2 you need to set at least ControlToValidate |
|
17 | + $value = ''; |
|
18 | + } |
|
19 | + $this->assertEquals('', $value); |
|
20 | 20 | } |
21 | 21 | } |
@@ -9,21 +9,21 @@ |
||
9 | 9 | class TDropDownListTest extends PHPUnit_Framework_TestCase { |
10 | 10 | |
11 | 11 | public function testSetDataSource() { |
12 | - $list = new TDropDownList(); |
|
13 | - $data = array('a' => 1, |
|
12 | + $list = new TDropDownList(); |
|
13 | + $data = array('a' => 1, |
|
14 | 14 | 'b' => 2, |
15 | 15 | 'c' => 3); |
16 | - $list->setDataSource($data); |
|
17 | - $list->dataBind(); |
|
18 | - $items = $list->getItems(); |
|
19 | - $this->assertTrue($items instanceof TListItemCollection); |
|
20 | - $expected_keys = array_keys($data); |
|
21 | - $i = 0; |
|
22 | - foreach($items as $item) { |
|
23 | - $this->assertEquals($expected_keys[$i], $item->getValue()); |
|
24 | - $this->assertEquals((string)$data[$expected_keys[$i]], $item->getText()); |
|
25 | - $i++; |
|
26 | - } |
|
16 | + $list->setDataSource($data); |
|
17 | + $list->dataBind(); |
|
18 | + $items = $list->getItems(); |
|
19 | + $this->assertTrue($items instanceof TListItemCollection); |
|
20 | + $expected_keys = array_keys($data); |
|
21 | + $i = 0; |
|
22 | + foreach($items as $item) { |
|
23 | + $this->assertEquals($expected_keys[$i], $item->getValue()); |
|
24 | + $this->assertEquals((string)$data[$expected_keys[$i]], $item->getText()); |
|
25 | + $i++; |
|
26 | + } |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -19,9 +19,9 @@ |
||
19 | 19 | $this->assertTrue($items instanceof TListItemCollection); |
20 | 20 | $expected_keys = array_keys($data); |
21 | 21 | $i = 0; |
22 | - foreach($items as $item) { |
|
22 | + foreach ($items as $item) { |
|
23 | 23 | $this->assertEquals($expected_keys[$i], $item->getValue()); |
24 | - $this->assertEquals((string)$data[$expected_keys[$i]], $item->getText()); |
|
24 | + $this->assertEquals((string) $data[$expected_keys[$i]], $item->getText()); |
|
25 | 25 | $i++; |
26 | 26 | } |
27 | 27 | } |
@@ -12,18 +12,18 @@ |
||
12 | 12 | |
13 | 13 | class Web_UI_WebControls_AllTests { |
14 | 14 | public static function main() { |
15 | - PHPUnit_TextUI_TestRunner::run(self::suite()); |
|
15 | + PHPUnit_TextUI_TestRunner::run(self::suite()); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | public static function suite() { |
19 | - $suite = new PHPUnit_Framework_TestSuite('System.Web.UI.WebControls'); |
|
19 | + $suite = new PHPUnit_Framework_TestSuite('System.Web.UI.WebControls'); |
|
20 | 20 | |
21 | 21 | $suite->addTestSuite('TDropDownListTest'); |
22 | 22 | $suite->addTestSuite('TLabelTest'); |
23 | 23 | $suite->addTestSuite('TRequiredFieldValidatorTest'); |
24 | - $suite->addTestSuite('TXmlTransformTest'); |
|
24 | + $suite->addTestSuite('TXmlTransformTest'); |
|
25 | 25 | |
26 | - return $suite; |
|
26 | + return $suite; |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -if(!defined('PHPUnit_MAIN_METHOD')) { |
|
4 | +if (!defined('PHPUnit_MAIN_METHOD')) { |
|
5 | 5 | define('PHPUnit_MAIN_METHOD', 'Web_UI_WebControls_AllTests::main'); |
6 | 6 | } |
7 | 7 | |
@@ -27,6 +27,6 @@ discard block |
||
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | -if(PHPUnit_MAIN_METHOD == 'Web_UI_WebControls_AllTests::main') { |
|
30 | +if (PHPUnit_MAIN_METHOD == 'Web_UI_WebControls_AllTests::main') { |
|
31 | 31 | Web_UI_WebControls_AllTests::main(); |
32 | 32 | } |
@@ -9,8 +9,8 @@ |
||
9 | 9 | class TActiveHiddenFieldTest extends PHPUnit_Framework_TestCase { |
10 | 10 | |
11 | 11 | public function testSetValue() { |
12 | - $field = new TActiveHiddenField(); |
|
13 | - $field->setValue('Test'); |
|
14 | - $this->assertEquals('Test', $field->getValue()); |
|
12 | + $field = new TActiveHiddenField(); |
|
13 | + $field->setValue('Test'); |
|
14 | + $this->assertEquals('Test', $field->getValue()); |
|
15 | 15 | } |
16 | 16 | } |
@@ -9,14 +9,14 @@ |
||
9 | 9 | |
10 | 10 | class Web_UI_ActiveControls_AllTests { |
11 | 11 | public static function main() { |
12 | - PHPUnit_TextUI_TestRunner::run(self::suite()); |
|
12 | + PHPUnit_TextUI_TestRunner::run(self::suite()); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | public static function suite() { |
16 | - $suite = new PHPUnit_Framework_TestSuite('System.Web.UI.ActiveControls'); |
|
16 | + $suite = new PHPUnit_Framework_TestSuite('System.Web.UI.ActiveControls'); |
|
17 | 17 | |
18 | 18 | $suite->addTestSuite('TActiveHiddenFieldTest'); |
19 | - return $suite; |
|
19 | + return $suite; |
|
20 | 20 | } |
21 | 21 | } |
22 | 22 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -if(!defined('PHPUnit_MAIN_METHOD')) { |
|
4 | +if (!defined('PHPUnit_MAIN_METHOD')) { |
|
5 | 5 | define('PHPUnit_MAIN_METHOD', 'Web_UI_ActiveControls_AllTests::main'); |
6 | 6 | } |
7 | 7 | |
@@ -20,6 +20,6 @@ discard block |
||
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | -if(PHPUnit_MAIN_METHOD == 'Web_UI_ActiveControls_AllTests::main') { |
|
23 | +if (PHPUnit_MAIN_METHOD == 'Web_UI_ActiveControls_AllTests::main') { |
|
24 | 24 | Web_UI_ActiveControls_AllTests::main(); |
25 | 25 | } |