|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* |
|
4
|
|
|
* @copyright (c) 2013 phpBB Group |
|
5
|
|
|
* @license http://opensource.org/licenses/gpl-3.0.php GNU General Public License v3 |
|
6
|
|
|
* @author MichaelC |
|
7
|
|
|
* |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace AppBundle\Tests\Controller; |
|
11
|
|
|
|
|
12
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; |
|
13
|
|
|
|
|
14
|
|
|
class BootstrapTestSuite extends WebTestCase |
|
15
|
|
|
{ |
|
16
|
|
|
public $client; |
|
17
|
|
|
public $crawler; |
|
18
|
|
|
public $response; |
|
19
|
|
|
|
|
20
|
|
|
protected function setupTest($path) |
|
21
|
|
|
{ |
|
22
|
|
|
$client = static::createClient(); |
|
23
|
|
|
$this->setClient($client); |
|
24
|
|
|
$client->enableProfiler(); |
|
25
|
|
|
$crawler = $client->request('GET', $path); |
|
26
|
|
|
$response = $client->getResponse(); |
|
27
|
|
|
$this->setupBootstrapping($client, $crawler, $response); |
|
28
|
|
|
|
|
29
|
|
|
return array('client' => $client, 'crawler' => $crawler, 'response' => $response); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function setupBootstrapping($client, $crawler, $response) |
|
33
|
|
|
{ |
|
34
|
|
|
$this->setClient($client); |
|
35
|
|
|
$this->setCrawler($crawler); |
|
36
|
|
|
$this->setResponse($response); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function globalTests($status = 200, $queries = 20) |
|
40
|
|
|
{ |
|
41
|
|
|
$this->assertTrue($this->crawler->filter('html:contains("phpBB Limited")')->count() > 0, 'Footer Check'); |
|
42
|
|
|
$this->assertTrue($this->crawler->filter('html:contains("About")')->count() > 0, 'Header Check'); |
|
43
|
|
|
$this->assertEquals($this->response->getStatusCode(), $status, 'Response Code Check'); |
|
44
|
|
|
$this->assertTrue($this->crawler->filter('html:contains("advertisements")')->count() > 0, 'Advertisments Check'); |
|
45
|
|
|
|
|
46
|
|
|
if (strpos(strval($status), '2') !== false) { |
|
47
|
|
|
$this->assertTrue($this->client->getResponse()->isSuccessful(), 'Response is a sucessful one'); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
if ($profile = $this->client->getProfile()) { |
|
51
|
|
|
$this->queryCheck($queries, $profile); |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
private function queryCheck($queries, $profile) |
|
56
|
|
|
{ |
|
57
|
|
|
// Shouldn't really have more than 20 queries on any page |
|
58
|
|
|
$this->assertLessThan( |
|
59
|
|
|
$queries, |
|
60
|
|
|
$profile->getCollector('db')->getQueryCount(), |
|
61
|
|
|
('Checks that query count is less than' . $queries . ' (token ' . $profile->getToken() .')') |
|
62
|
|
|
); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function get($dependency) |
|
66
|
|
|
{ |
|
67
|
|
|
$container = $this->client->getContainer(); |
|
68
|
|
|
|
|
69
|
|
|
return $container->get($dependency); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
private function dropTablesInDatabase($symfonyConnection, $phpbbConnection) |
|
73
|
|
|
{ |
|
74
|
|
|
// Check what tables exists |
|
75
|
|
|
$symfonyOldTables = $symfonyConnection->fetchAll('SHOW TABLES'); |
|
76
|
|
|
$phpbbOldTables = $phpbbConnection->fetchAll('SHOW TABLES'); |
|
77
|
|
|
|
|
78
|
|
|
// Delete existing tables |
|
79
|
|
|
foreach ($symfonyOldTables as $i => $oldTable) { |
|
80
|
|
|
foreach ($oldTable as $key => $oldTableName) { |
|
81
|
|
|
$symfonyConnection->query('DROP TABLE '. $oldTableName); |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
foreach ($phpbbOldTables as $i => $oldTable) { |
|
86
|
|
|
foreach ($oldTable as $key => $oldTableName) { |
|
87
|
|
|
$phpbbConnection->query('DROP TABLE '. $oldTableName); |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
public function setupDatabase($symfonyTables, $phpbbTables) |
|
93
|
|
|
{ |
|
94
|
|
|
// Connections to databases |
|
95
|
|
|
$symfonyConnection = $this->get('database_connection'); |
|
96
|
|
|
$phpbbConnection = $this->get('doctrine.dbal.phpbb_connection'); |
|
97
|
|
|
|
|
98
|
|
|
$this->dropTablesInDatabase($symfonyConnection, $phpbbConnection); |
|
99
|
|
|
|
|
100
|
|
|
// Add each symfony table's fixtures for those tables needed |
|
101
|
|
|
foreach ($symfonyTables as $symfonyTable) { |
|
102
|
|
|
$sql = $this->getSymfonyFixtures($symfonyTable); |
|
103
|
|
|
|
|
104
|
|
|
if ($sql) { |
|
105
|
|
|
$symfonyConnection->query($sql); |
|
106
|
|
|
unset($sql); |
|
107
|
|
|
} |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
// Add each phpbb table's fixtures for those tables needed |
|
111
|
|
|
foreach ($phpbbTables as $phpbbTable) { |
|
112
|
|
|
$sql = $this->getPhpbbFixtures($phpbbTable); |
|
113
|
|
|
|
|
114
|
|
|
if ($sql) { |
|
|
|
|
|
|
115
|
|
|
$phpbbConnection->query($sql); |
|
116
|
|
|
unset($sql); |
|
117
|
|
|
} |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
return; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
private function getSymfonyFixtures($table) |
|
124
|
|
|
{ |
|
125
|
|
|
switch ($table) { |
|
126
|
|
|
// Case statement |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
return (isset($sql) ? $sql : null); |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
private function getPhpbbFixtures($table) |
|
133
|
|
|
{ |
|
134
|
|
|
switch ($table) { |
|
135
|
|
|
case 'c_posts': |
|
136
|
|
|
$sql = " |
|
137
|
|
|
CREATE TABLE IF NOT EXISTS `c_posts` ( |
|
138
|
|
|
`post_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, |
|
139
|
|
|
`topic_id` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
140
|
|
|
`forum_id` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
141
|
|
|
`poster_id` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
142
|
|
|
`icon_id` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
143
|
|
|
`poster_ip` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
144
|
|
|
`post_time` int(11) unsigned NOT NULL DEFAULT '0', |
|
145
|
|
|
`post_reported` tinyint(1) unsigned NOT NULL DEFAULT '0', |
|
146
|
|
|
`enable_bbcode` tinyint(1) unsigned NOT NULL DEFAULT '1', |
|
147
|
|
|
`enable_smilies` tinyint(1) unsigned NOT NULL DEFAULT '1', |
|
148
|
|
|
`enable_magic_url` tinyint(1) unsigned NOT NULL DEFAULT '1', |
|
149
|
|
|
`enable_sig` tinyint(1) unsigned NOT NULL DEFAULT '1', |
|
150
|
|
|
`post_username` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
151
|
|
|
`post_subject` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', |
|
152
|
|
|
`post_text` mediumtext COLLATE utf8_bin NOT NULL, |
|
153
|
|
|
`post_checksum` varchar(32) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
154
|
|
|
`post_attachment` tinyint(1) unsigned NOT NULL DEFAULT '0', |
|
155
|
|
|
`bbcode_bitfield` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
156
|
|
|
`bbcode_uid` varchar(8) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
157
|
|
|
`post_postcount` tinyint(1) unsigned NOT NULL DEFAULT '1', |
|
158
|
|
|
`post_edit_time` int(11) unsigned NOT NULL DEFAULT '0', |
|
159
|
|
|
`post_edit_reason` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
160
|
|
|
`post_edit_user` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
161
|
|
|
`post_edit_count` smallint(4) unsigned NOT NULL DEFAULT '0', |
|
162
|
|
|
`post_edit_locked` tinyint(1) unsigned NOT NULL DEFAULT '0', |
|
163
|
|
|
`post_visibility` tinyint(3) NOT NULL DEFAULT '0', |
|
164
|
|
|
`post_delete_time` int(11) unsigned NOT NULL DEFAULT '0', |
|
165
|
|
|
`post_delete_reason` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
166
|
|
|
`post_delete_user` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
167
|
|
|
PRIMARY KEY (`post_id`), |
|
168
|
|
|
KEY `forum_id` (`forum_id`), |
|
169
|
|
|
KEY `topic_id` (`topic_id`), |
|
170
|
|
|
KEY `poster_ip` (`poster_ip`), |
|
171
|
|
|
KEY `poster_id` (`poster_id`), |
|
172
|
|
|
KEY `post_username` (`post_username`), |
|
173
|
|
|
KEY `tid_post_time` (`topic_id`,`post_time`), |
|
174
|
|
|
KEY `post_visibility` (`post_visibility`) |
|
175
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=6 ; |
|
176
|
|
|
|
|
177
|
|
|
-- |
|
178
|
|
|
-- Dumping data for table `c_posts` |
|
179
|
|
|
-- |
|
180
|
|
|
|
|
181
|
|
|
INSERT INTO `c_posts` (`post_id`, `topic_id`, `forum_id`, `poster_id`, `icon_id`, `poster_ip`, `post_time`, `post_reported`, `enable_bbcode`, `enable_smilies`, `enable_magic_url`, `enable_sig`, `post_username`, `post_subject`, `post_text`, `post_checksum`, `post_attachment`, `bbcode_bitfield`, `bbcode_uid`, `post_postcount`, `post_edit_time`, `post_edit_reason`, `post_edit_user`, `post_edit_count`, `post_edit_locked`, `post_visibility`, `post_delete_time`, `post_delete_reason`, `post_delete_user`) VALUES |
|
182
|
|
|
(1, 1, 2, 2, 0, '127.0.0.1', 1343840387, 0, 1, 1, 1, 1, '', 'Welcome to phpBB3', 'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. During the installation process your first category and your first forum are assigned an appropriate set of permissions for the predefined usergroups administrators, bots, global moderators, guests, registered users and registered COPPA users. If you also choose to delete your first category and your first forum, do not forget to assign permissions for all these usergroups for all new categories and forums you create. It is recommended to rename your first category and your first forum and copy permissions from these while creating new categories and forums. Have fun!', '5dd683b17f641daf84c040bfefc58ce9', 0, '', '', 1, 0, '', 0, 0, 0, 1, 0, '', 0), |
|
183
|
|
|
(2, 2, 14, 2, 0, '127.0.0.1', 1376676604, 0, 1, 1, 1, 1, '', 'this should not show if it does die', 'No Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\ntempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\nquis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\nconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\ncillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\nproident, sunt in culpa qui officia deserunt mollit anim id est laborum.', '08a963224e1894a0f6ded63172f818d2', 0, '', '1fzugufv', 1, 0, '', 0, 0, 0, 1, 0, '', 0), |
|
184
|
|
|
(3, 3, 14, 2, 0, '127.0.0.1', 1376676710, 0, 1, 1, 1, 1, '', 'another', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\ntempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\nquis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\nconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\ncillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\nproident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'bdf55c952333a4f0992f429e152f03f7', 0, '', '1yurb15i', 1, 0, '', 0, 0, 0, 1, 0, '', 0), |
|
185
|
|
|
(4, 4, 14, 2, 0, '127.0.0.1', 1376676762, 0, 1, 1, 1, 1, '', 'third', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\ntempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\nquis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\nconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\ncillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\nproident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'bdf55c952333a4f0992f429e152f03f7', 0, '', '2y44jt86', 1, 0, '', 0, 0, 0, 1, 0, '', 0), |
|
186
|
|
|
(5, 5, 14, 2, 0, '127.0.0.1', 1376676815, 0, 1, 1, 1, 1, '', 'show', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\ntempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\nquis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\nconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\ncillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\nproident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'bdf55c952333a4f0992f429e152f03f7', 0, '', '32fdkg1c', 1, 0, '', 0, 0, 0, 1, 0, '', 0); |
|
187
|
|
|
"; |
|
188
|
|
|
break; |
|
189
|
|
|
|
|
190
|
|
|
case 'c_topics': |
|
191
|
|
|
$sql = " |
|
192
|
|
|
CREATE TABLE IF NOT EXISTS `c_topics` ( |
|
193
|
|
|
`topic_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, |
|
194
|
|
|
`forum_id` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
195
|
|
|
`icon_id` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
196
|
|
|
`topic_attachment` tinyint(1) unsigned NOT NULL DEFAULT '0', |
|
197
|
|
|
`topic_reported` tinyint(1) unsigned NOT NULL DEFAULT '0', |
|
198
|
|
|
`topic_title` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '', |
|
199
|
|
|
`topic_poster` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
200
|
|
|
`topic_time` int(11) unsigned NOT NULL DEFAULT '0', |
|
201
|
|
|
`topic_time_limit` int(11) unsigned NOT NULL DEFAULT '0', |
|
202
|
|
|
`topic_views` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
203
|
|
|
`topic_status` tinyint(3) NOT NULL DEFAULT '0', |
|
204
|
|
|
`topic_type` tinyint(3) NOT NULL DEFAULT '0', |
|
205
|
|
|
`topic_first_post_id` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
206
|
|
|
`topic_first_poster_name` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
207
|
|
|
`topic_first_poster_colour` varchar(6) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
208
|
|
|
`topic_last_post_id` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
209
|
|
|
`topic_last_poster_id` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
210
|
|
|
`topic_last_poster_name` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
211
|
|
|
`topic_last_poster_colour` varchar(6) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
212
|
|
|
`topic_last_post_subject` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
213
|
|
|
`topic_last_post_time` int(11) unsigned NOT NULL DEFAULT '0', |
|
214
|
|
|
`topic_last_view_time` int(11) unsigned NOT NULL DEFAULT '0', |
|
215
|
|
|
`topic_moved_id` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
216
|
|
|
`topic_bumped` tinyint(1) unsigned NOT NULL DEFAULT '0', |
|
217
|
|
|
`topic_bumper` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
218
|
|
|
`poll_title` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
219
|
|
|
`poll_start` int(11) unsigned NOT NULL DEFAULT '0', |
|
220
|
|
|
`poll_length` int(11) unsigned NOT NULL DEFAULT '0', |
|
221
|
|
|
`poll_max_options` tinyint(4) NOT NULL DEFAULT '1', |
|
222
|
|
|
`poll_last_vote` int(11) unsigned NOT NULL DEFAULT '0', |
|
223
|
|
|
`poll_vote_change` tinyint(1) unsigned NOT NULL DEFAULT '0', |
|
224
|
|
|
`topic_visibility` tinyint(3) NOT NULL DEFAULT '0', |
|
225
|
|
|
`topic_delete_time` int(11) unsigned NOT NULL DEFAULT '0', |
|
226
|
|
|
`topic_delete_reason` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', |
|
227
|
|
|
`topic_delete_user` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
228
|
|
|
`topic_posts_approved` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
229
|
|
|
`topic_posts_unapproved` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
230
|
|
|
`topic_posts_softdeleted` mediumint(8) unsigned NOT NULL DEFAULT '0', |
|
231
|
|
|
PRIMARY KEY (`topic_id`), |
|
232
|
|
|
KEY `forum_id` (`forum_id`), |
|
233
|
|
|
KEY `forum_id_type` (`forum_id`,`topic_type`), |
|
234
|
|
|
KEY `last_post_time` (`topic_last_post_time`), |
|
235
|
|
|
KEY `fid_time_moved` (`forum_id`,`topic_last_post_time`,`topic_moved_id`), |
|
236
|
|
|
KEY `topic_visibility` (`topic_visibility`), |
|
237
|
|
|
KEY `forum_vis_last` (`forum_id`,`topic_visibility`,`topic_last_post_id`) |
|
238
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=6 ; |
|
239
|
|
|
|
|
240
|
|
|
-- |
|
241
|
|
|
-- Dumping data for table `c_topics` |
|
242
|
|
|
-- |
|
243
|
|
|
|
|
244
|
|
|
INSERT INTO `c_topics` (`topic_id`, `forum_id`, `icon_id`, `topic_attachment`, `topic_reported`, `topic_title`, `topic_poster`, `topic_time`, `topic_time_limit`, `topic_views`, `topic_status`, `topic_type`, `topic_first_post_id`, `topic_first_poster_name`, `topic_first_poster_colour`, `topic_last_post_id`, `topic_last_poster_id`, `topic_last_poster_name`, `topic_last_poster_colour`, `topic_last_post_subject`, `topic_last_post_time`, `topic_last_view_time`, `topic_moved_id`, `topic_bumped`, `topic_bumper`, `poll_title`, `poll_start`, `poll_length`, `poll_max_options`, `poll_last_vote`, `poll_vote_change`, `topic_visibility`, `topic_delete_time`, `topic_delete_reason`, `topic_delete_user`, `topic_posts_approved`, `topic_posts_unapproved`, `topic_posts_softdeleted`) VALUES |
|
245
|
|
|
(1, 2, 0, 0, 0, 'Welcome to phpBB3', 2, 1343840387, 0, 2, 0, 0, 1, 'UKB', '000000', 1, 2, 'UKB', '000000', 'Welcome to phpBB3', 1343840387, 1405344757, 0, 0, 0, '', 0, 0, 1, 0, 0, 1, 0, '', 0, 1, 0, 0), |
|
246
|
|
|
(2, 14, 0, 0, 0, 'this should not show if it does die', 2, 1376676604, 0, 2, 0, 0, 2, 'UKB', '000000', 2, 2, 'UKB', '000000', 'this should not show if it does die', 1376676604, 1376677290, 0, 0, 0, '', 0, 0, 0, 0, 0, 1, 0, '', 0, 1, 0, 0), |
|
247
|
|
|
(3, 14, 0, 0, 0, 'another', 2, 1376676710, 0, 1, 0, 0, 3, 'UKB', '000000', 3, 2, 'UKB', '000000', 'another', 1376676710, 1376677005, 0, 0, 0, '', 0, 0, 0, 0, 0, 1, 0, '', 0, 1, 0, 0), |
|
248
|
|
|
(4, 14, 0, 0, 0, 'third', 2, 1376676762, 0, 1, 0, 0, 4, 'UKB', '000000', 4, 2, 'UKB', '000000', 'third', 1376676762, 1376677091, 0, 0, 0, '', 0, 0, 0, 0, 0, 1, 0, '', 0, 1, 0, 0), |
|
249
|
|
|
(5, 14, 0, 0, 0, 'show', 2, 1376676815, 0, 1, 0, 0, 5, 'UKB', '000000', 5, 2, 'UKB', '000000', 'show', 1376676815, 1376677160, 0, 0, 0, '', 0, 0, 0, 0, 0, 1, 0, '', 0, 1, 0, 0); |
|
250
|
|
|
"; |
|
251
|
|
|
break; |
|
252
|
|
|
} |
|
253
|
|
|
|
|
254
|
|
|
return (isset($sql) ? $sql : null); |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
/** |
|
258
|
|
|
* Gets the value of client. |
|
259
|
|
|
* |
|
260
|
|
|
* @return mixed |
|
261
|
|
|
*/ |
|
262
|
|
|
public function getClient() |
|
263
|
|
|
{ |
|
264
|
|
|
return $this->client; |
|
265
|
|
|
} |
|
266
|
|
|
|
|
267
|
|
|
/** |
|
268
|
|
|
* Sets the value of client. |
|
269
|
|
|
* |
|
270
|
|
|
* @param mixed $client the client |
|
271
|
|
|
* |
|
272
|
|
|
* @return self |
|
273
|
|
|
*/ |
|
274
|
|
|
public function setClient($client) |
|
275
|
|
|
{ |
|
276
|
|
|
$this->client = $client; |
|
277
|
|
|
|
|
278
|
|
|
return $this; |
|
279
|
|
|
} |
|
280
|
|
|
|
|
281
|
|
|
/** |
|
282
|
|
|
* Gets the value of crawler. |
|
283
|
|
|
* |
|
284
|
|
|
* @return mixed |
|
285
|
|
|
*/ |
|
286
|
|
|
public function getCrawler() |
|
287
|
|
|
{ |
|
288
|
|
|
return $this->crawler; |
|
289
|
|
|
} |
|
290
|
|
|
|
|
291
|
|
|
/** |
|
292
|
|
|
* Sets the value of crawler. |
|
293
|
|
|
* |
|
294
|
|
|
* @param mixed $crawler the crawler |
|
295
|
|
|
* |
|
296
|
|
|
* @return self |
|
297
|
|
|
*/ |
|
298
|
|
|
public function setCrawler($crawler) |
|
299
|
|
|
{ |
|
300
|
|
|
$this->crawler = $crawler; |
|
301
|
|
|
|
|
302
|
|
|
return $this; |
|
303
|
|
|
} |
|
304
|
|
|
|
|
305
|
|
|
/** |
|
306
|
|
|
* Gets the value of response. |
|
307
|
|
|
* |
|
308
|
|
|
* @return mixed |
|
309
|
|
|
*/ |
|
310
|
|
|
public function getResponse() |
|
311
|
|
|
{ |
|
312
|
|
|
return $this->response; |
|
313
|
|
|
} |
|
314
|
|
|
|
|
315
|
|
|
/** |
|
316
|
|
|
* Sets the value of response. |
|
317
|
|
|
* |
|
318
|
|
|
* @param mixed $response the response |
|
319
|
|
|
* |
|
320
|
|
|
* @return self |
|
321
|
|
|
*/ |
|
322
|
|
|
public function setResponse($response) |
|
323
|
|
|
{ |
|
324
|
|
|
$this->response = $response; |
|
325
|
|
|
|
|
326
|
|
|
return $this; |
|
327
|
|
|
} |
|
328
|
|
|
} |
|
329
|
|
|
|
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: