Changeset 1258 in tests
- Timestamp:
- 04/09/2013 08:53:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/post/formats.php
r1148 r1258 94 94 $this->assertFalse( has_post_format( 'aside', 12345 ) ); 95 95 } 96 97 /** 98 * @ticket 23625 99 */ 100 function test_get_content_chat() { 101 $data =<<<DATA 102 Scott: Hey. 103 Nacin: Go away. 104 DATA; 105 106 $stanzas = get_content_chat( $data ); 107 $expected = array( 108 array( 109 array( 110 'time' => '', 111 'author' => 'Scott', 112 'message' => 'Hey.' 113 ), 114 array( 115 'time' => '', 116 'author' => 'Nacin', 117 'message' => 'Go away.' 118 ) 119 ) 120 ); 121 $this->assertEquals( $stanzas, $expected ); 122 123 $data =<<<DATA 124 Scott: Hey. 125 Nacin: Go away. 126 127 Nacin is mean to me. 128 DATA; 129 130 $stanzas = get_content_chat( $data ); 131 $this->assertEquals( $stanzas, $expected ); 132 133 $data =<<<DATA 134 Scott: Hey. 135 I have a question. 136 Nacin: Go away. 137 DATA; 138 139 $stanzas = get_content_chat( $data ); 140 $expected = array( 141 array( 142 array( 143 'time' => '', 144 'author' => 'Scott', 145 'message' => 'Hey. I have a question.' 146 ), 147 array( 148 'time' => '', 149 'author' => 'Nacin', 150 'message' => 'Go away.' 151 ) 152 ) 153 ); 154 155 $data =<<<DATA 156 Scott: Hey. 157 I have a question: what is your favorite color? 158 Nacin: Go away. 159 DATA; 160 161 $stanzas = get_content_chat( $data ); 162 $expected = array( 163 array( 164 array( 165 'time' => '', 166 'author' => 'Scott', 167 'message' => 'Hey. I have a question: what is your favorite color?' 168 ), 169 array( 170 'time' => '', 171 'author' => 'Nacin', 172 'message' => 'Go away.' 173 ) 174 ) 175 ); 176 $this->assertEquals( $stanzas, $expected ); 177 178 $data =<<<DATA 179 Scott: Hey. 180 I have a question: will you read this http://www.justinbieber.com ? 181 Nacin: Go away. 182 183 Nacin hates Justin Bieber. 184 DATA; 185 186 $stanzas = get_content_chat( $data ); 187 $expected = array( 188 array( 189 array( 190 'time' => '', 191 'author' => 'Scott', 192 'message' => 'Hey. I have a question: will you read this <a href="http://www.justinbieber.com" rel="nofollow">http://www.justinbieber.com</a> ?' 193 ), 194 array( 195 'time' => '', 196 'author' => 'Nacin', 197 'message' => 'Go away.' 198 ) 199 ) 200 ); 201 $this->assertEquals( $stanzas, $expected ); 202 203 $data =<<<DATA 204 Scott: Hey. 205 I have a question: what is your favorite color? 206 Nacin: Go away. 207 208 Nacin hates color. 209 DATA; 210 211 $stanzas = get_content_chat( $data ); 212 $expected = array( 213 array( 214 array( 215 'time' => '', 216 'author' => 'Scott', 217 'message' => 'Hey. I have a question: what is your favorite color?' 218 ), 219 array( 220 'time' => '', 221 'author' => 'Nacin', 222 'message' => 'Go away.' 223 ) 224 ) 225 ); 226 $this->assertEquals( $stanzas, $expected ); 227 228 $data =<<<DATA 229 Scott: Hey. 230 Nacin: Go away. 231 232 Helen: Hey. 233 Nacin: Go away. 234 DATA; 235 236 $stanzas = get_content_chat( $data ); 237 $expected = array( 238 array( 239 array( 240 'time' => '', 241 'author' => 'Scott', 242 'message' => 'Hey.' 243 ), 244 array( 245 'time' => '', 246 'author' => 'Nacin', 247 'message' => 'Go away.' 248 ) 249 250 ), 251 array( 252 array( 253 'time' => '', 254 'author' => 'Helen', 255 'message' => 'Hey.' 256 ), 257 array( 258 'time' => '', 259 'author' => 'Nacin', 260 'message' => 'Go away.' 261 ) 262 ) 263 ); 264 $this->assertEquals( $stanzas, $expected ); 265 266 $data =<<<DATA 267 268 Scott: Hey. 269 Nacin: Go away. 270 271 Helen: Hey. 272 Nacin: Go away. 273 274 Nacin appears busy today. 275 DATA; 276 277 $stanzas = get_content_chat( $data ); 278 $this->assertEquals( $stanzas, $expected ); 279 280 $data =<<<DATA 281 Scott: Hey. 282 I have a question: what is your favorite color? 283 Nacin: Go away. 284 285 Helen: Hey. 286 I have a question: what is your favorite pizza topping? 287 Nacin: Go away. 288 DATA; 289 290 $stanzas = get_content_chat( $data ); 291 $expected = array( 292 array( 293 array( 294 'time' => '', 295 'author' => 'Scott', 296 'message' => 'Hey. I have a question: what is your favorite color?' 297 ), 298 array( 299 'time' => '', 300 'author' => 'Nacin', 301 'message' => 'Go away.' 302 ) 303 ), 304 array( 305 array( 306 'time' => '', 307 'author' => 'Helen', 308 'message' => 'Hey. I have a question: what is your favorite pizza topping?' 309 ), 310 array( 311 'time' => '', 312 'author' => 'Nacin', 313 'message' => 'Go away.' 314 ) 315 ) 316 ); 317 $this->assertEquals( $stanzas, $expected ); 318 319 $data =<<<DATA 320 Scott: Hey. 321 I have a question: what is your favorite color? 322 Nacin: Go away. 323 324 Helen: Hey. 325 I have a question: what is your favorite pizza topping? 326 Nacin: Go away. 327 328 Nacin hates color and pizza. 329 DATA; 330 331 $stanzas = get_content_chat( $data ); 332 $this->assertEquals( $stanzas, $expected ); 333 334 $data =<<<DATA 335 [3/7/13 11:19:33 AM] Helen Hou-Sandi: I like Apples. 336 [3/7/13 11:29:31 AM] Scott Taylor: word 337 DATA; 338 339 $expected = array( 340 array( 341 array( 342 'time' => '[3/7/13 11:19:33 AM]', 343 'author' => 'Helen Hou-Sandi', 344 'message' => 'I like Apples.' 345 ), 346 array( 347 'time' => '[3/7/13 11:29:31 AM]', 348 'author' => 'Scott Taylor', 349 'message' => 'word' 350 ), 351 ) 352 ); 353 354 $stanzas = get_content_chat( $data ); 355 $this->assertEquals( $stanzas, $expected ); 356 357 $data =<<<DATA 358 [3/5/13 2:30:09 PM] Scott Taylor: https://github.com/johndyer/mediaelement 359 [3/5/13 2:30:15 PM] Scott Taylor: MIT 360 [3/5/13 2:31:13 PM] Andrew Nacin: https://github.com/johndyer/mediaelement/issues?labels=Wordpress 361 DATA; 362 363 $expected = array( 364 array( 365 array( 366 'time' => '[3/5/13 2:30:09 PM]', 367 'author' => 'Scott Taylor', 368 'message' => '<a href="https://github.com/johndyer/mediaelement" rel="nofollow">https://github.com/johndyer/mediaelement</a>' 369 ), 370 array( 371 'time' => '[3/5/13 2:30:15 PM]', 372 'author' => 'Scott Taylor', 373 'message' => 'MIT' 374 ), 375 array( 376 'time' => '[3/5/13 2:31:13 PM]', 377 'author' => 'Andrew Nacin', 378 'message' => '<a href="https://github.com/johndyer/mediaelement/issues?labels=Wordpress" rel="nofollow">https://github.com/johndyer/mediaelement/issues?labels=Wordpress</a>' 379 ), 380 ) 381 ); 382 383 $stanzas = get_content_chat( $data ); 384 $this->assertEquals( $stanzas, $expected ); 385 386 $data = <<<DATA 387 Nigel Tufnel: The numbers all go to eleven. Look, right across the board, eleven, eleven, eleven and… 388 389 Marti DiBergi: Oh, I see. And most amps go up to ten? 390 391 Nigel Tufnel: Exactly. 392 393 Marti DiBergi: Does that mean it’s louder? Is it any louder? 394 395 Nigel Tufnel: Well, it’s one louder, isn’t it? It’s not ten. You see, most blokes, you know, will be playing at ten. You’re on ten here, all the way up, all the way up, all the way up, you’re on ten on your guitar. Where can you go from there? Where? 396 397 Marti DiBergi: I don’t know. 398 399 Nigel Tufnel: Nowhere. Exactly. What we do is, if we need that extra push over the cliff, you know what we do? 400 401 Marti DiBergi: Put it up to eleven. 402 403 Nigel Tufnel: Eleven. Exactly. One louder. 404 405 Marti DiBergi: Why don’t you just make ten louder and make ten be the top number and make that a little louder? 406 407 Nigel Tufnel: These go to eleven. 408 DATA; 409 410 $expected = array( 411 array( 412 array( 413 'time' => '', 414 'author' => 'Nigel Tufnel', 415 'message' => 'The numbers all go to eleven. Look, right across the board, eleven, eleven, eleven and…' 416 ) 417 ), 418 array( 419 array( 420 'time' => '', 421 'author' => 'Marti DiBergi', 422 'message' => 'Oh, I see. And most amps go up to ten?' 423 ) 424 ), 425 array( 426 array( 427 'time' => '', 428 'author' => 'Nigel Tufnel', 429 'message' => 'Exactly.' 430 ) 431 ), 432 array( 433 array( 434 'time' => '', 435 'author' => 'Marti DiBergi', 436 'message' => 'Does that mean it’s louder? Is it any louder?' 437 ) 438 ), 439 array( 440 array( 441 'time' => '', 442 'author' => 'Nigel Tufnel', 443 'message' => 'Well, it’s one louder, isn’t it? It’s not ten. You see, most blokes, you know, will be playing at ten. You’re on ten here, all the way up, all the way up, all the way up, you’re on ten on your guitar. Where can you go from there? Where?' 444 ) 445 ), 446 array( 447 array( 448 'time' => '', 449 'author' => 'Marti DiBergi', 450 'message' => 'I don’t know.' 451 ) 452 ), 453 array( 454 array( 455 'time' => '', 456 'author' => 'Nigel Tufnel', 457 'message' => 'Nowhere. Exactly. What we do is, if we need that extra push over the cliff, you know what we do?' 458 ) 459 ), 460 array( 461 array( 462 'time' => '', 463 'author' => 'Marti DiBergi', 464 'message' => 'Put it up to eleven.' 465 ) 466 ), 467 array( 468 array( 469 'time' => '', 470 'author' => 'Nigel Tufnel', 471 'message' => 'Eleven. Exactly. One louder.' 472 ) 473 ), 474 array( 475 array( 476 'time' => '', 477 'author' => 'Marti DiBergi', 478 'message' => 'Why don’t you just make ten louder and make ten be the top number and make that a little louder?' 479 ) 480 ), 481 array( 482 array( 483 'time' => '', 484 'author' => 'Nigel Tufnel', 485 'message' => 'These go to eleven.' 486 ) 487 ), 488 ); 489 $stanzas = get_content_chat( $data ); 490 $this->assertEquals( $stanzas, $expected ); 491 } 96 492 }
Note: See TracChangeset
for help on using the changeset viewer.