Changeset 42343 for trunk/tests/phpunit/tests/rewrite/numericSlugs.php
- Timestamp:
- 11/30/2017 11:09:33 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rewrite/numericSlugs.php
r39626 r42343 25 25 $this->set_permalink_structure( '/%postname%/' ); 26 26 27 $id = self::factory()->post->create( array( 28 'post_author' => $this->author_id, 29 'post_status' => 'publish', 30 'post_content' => rand_str(), 31 'post_title' => '', 32 'post_name' => '2015', 33 'post_date' => '2015-02-01 01:00:00' 34 ) ); 27 $id = self::factory()->post->create( 28 array( 29 'post_author' => $this->author_id, 30 'post_status' => 'publish', 31 'post_content' => rand_str(), 32 'post_title' => '', 33 'post_name' => '2015', 34 'post_date' => '2015-02-01 01:00:00', 35 ) 36 ); 35 37 36 38 // Force an ID that resembles a year format … … 39 41 array( 40 42 'ID' => '2015', 41 'guid' => 'http://' . WP_TESTS_DOMAIN . '/?p=2015' 43 'guid' => 'http://' . WP_TESTS_DOMAIN . '/?p=2015', 42 44 ), 43 45 array( 'ID' => $id ) … … 53 55 $this->set_permalink_structure( '/%postname%/' ); 54 56 55 $id = self::factory()->post->create( array( 56 'post_author' => $this->author_id, 57 'post_status' => 'publish', 58 'post_content' => rand_str(), 59 'post_title' => '', 60 'post_name' => '2015', 61 'post_date' => '2015-02-01 01:00:00' 62 ) ); 57 $id = self::factory()->post->create( 58 array( 59 'post_author' => $this->author_id, 60 'post_status' => 'publish', 61 'post_content' => rand_str(), 62 'post_title' => '', 63 'post_name' => '2015', 64 'post_date' => '2015-02-01 01:00:00', 65 ) 66 ); 63 67 64 68 // Force an ID that resembles a year format … … 67 71 array( 68 72 'ID' => '2015', 69 'guid' => 'http://' . WP_TESTS_DOMAIN . '/?p=2015' 73 'guid' => 'http://' . WP_TESTS_DOMAIN . '/?p=2015', 70 74 ), 71 75 array( 'ID' => $id ) … … 78 82 $this->set_permalink_structure( '/%postname%/' ); 79 83 80 $id = self::factory()->post->create( array( 81 'post_author' => $this->author_id, 82 'post_status' => 'publish', 83 'post_content' => rand_str(), 84 'post_title' => '2015', 85 'post_date' => '2015-02-01 01:00:00', 86 ) ); 84 $id = self::factory()->post->create( 85 array( 86 'post_author' => $this->author_id, 87 'post_status' => 'publish', 88 'post_content' => rand_str(), 89 'post_title' => '2015', 90 'post_date' => '2015-02-01 01:00:00', 91 ) 92 ); 87 93 88 94 $this->go_to( get_permalink( $id ) ); … … 94 100 $this->set_permalink_structure( '/%postname%/' ); 95 101 96 $id = self::factory()->post->create( array( 97 'post_author' => $this->author_id, 98 'post_status' => 'publish', 99 'post_content' => rand_str(), 100 'post_title' => '2015', 101 'post_date' => '2015-02-01 01:00:00', 102 ) ); 102 $id = self::factory()->post->create( 103 array( 104 'post_author' => $this->author_id, 105 'post_status' => 'publish', 106 'post_content' => rand_str(), 107 'post_title' => '2015', 108 'post_date' => '2015-02-01 01:00:00', 109 ) 110 ); 103 111 104 112 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); … … 108 116 $this->set_permalink_structure( '/%year%/%postname%/' ); 109 117 110 $id = self::factory()->post->create( array( 111 'post_author' => $this->author_id, 112 'post_status' => 'publish', 113 'post_content' => rand_str(), 114 'post_title' => '', 115 'post_name' => '02', 116 'post_date' => '2015-02-01 01:00:00', 117 ) ); 118 $id = self::factory()->post->create( 119 array( 120 'post_author' => $this->author_id, 121 'post_status' => 'publish', 122 'post_content' => rand_str(), 123 'post_title' => '', 124 'post_name' => '02', 125 'post_date' => '2015-02-01 01:00:00', 126 ) 127 ); 118 128 119 129 $this->go_to( get_permalink( $id ) ); … … 125 135 $this->set_permalink_structure( '/%year%/%postname%/' ); 126 136 127 $id = self::factory()->post->create( array( 128 'post_author' => $this->author_id, 129 'post_status' => 'publish', 130 'post_content' => rand_str(), 131 'post_title' => '', 132 'post_name' => '02', 133 'post_date' => '2015-02-01 01:00:00', 134 ) ); 137 $id = self::factory()->post->create( 138 array( 139 'post_author' => $this->author_id, 140 'post_status' => 'publish', 141 'post_content' => rand_str(), 142 'post_title' => '', 143 'post_name' => '02', 144 'post_date' => '2015-02-01 01:00:00', 145 ) 146 ); 135 147 136 148 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); … … 140 152 $this->set_permalink_structure( '/%year%/%postname%/' ); 141 153 142 $id = self::factory()->post->create( array( 143 'post_author' => $this->author_id, 144 'post_status' => 'publish', 145 'post_content' => rand_str(), 146 'post_title' => '', 147 'post_name' => '2', 148 'post_date' => '2015-02-01 01:00:00', 149 ) ); 154 $id = self::factory()->post->create( 155 array( 156 'post_author' => $this->author_id, 157 'post_status' => 'publish', 158 'post_content' => rand_str(), 159 'post_title' => '', 160 'post_name' => '2', 161 'post_date' => '2015-02-01 01:00:00', 162 ) 163 ); 150 164 151 165 $this->go_to( get_permalink( $id ) ); … … 157 171 $this->set_permalink_structure( '/%year%/%postname%/' ); 158 172 159 $id = self::factory()->post->create( array( 160 'post_author' => $this->author_id, 161 'post_status' => 'publish', 162 'post_content' => rand_str(), 163 'post_title' => '', 164 'post_name' => '2', 165 'post_date' => '2015-02-01 01:00:00', 166 ) ); 173 $id = self::factory()->post->create( 174 array( 175 'post_author' => $this->author_id, 176 'post_status' => 'publish', 177 'post_content' => rand_str(), 178 'post_title' => '', 179 'post_name' => '2', 180 'post_date' => '2015-02-01 01:00:00', 181 ) 182 ); 167 183 168 184 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); … … 172 188 $this->set_permalink_structure( '/%year%/%postname%/' ); 173 189 174 $id = self::factory()->post->create( array( 175 'post_author' => $this->author_id, 176 'post_status' => 'publish', 177 'post_content' => rand_str(), 178 'post_title' => '02', 179 'post_date' => '2015-02-01 01:00:00', 180 ) ); 190 $id = self::factory()->post->create( 191 array( 192 'post_author' => $this->author_id, 193 'post_status' => 'publish', 194 'post_content' => rand_str(), 195 'post_title' => '02', 196 'post_date' => '2015-02-01 01:00:00', 197 ) 198 ); 181 199 182 200 $this->go_to( get_permalink( $id ) ); … … 188 206 $this->set_permalink_structure( '/%year%/%postname%/' ); 189 207 190 $id = self::factory()->post->create( array( 191 'post_author' => $this->author_id, 192 'post_status' => 'publish', 193 'post_content' => rand_str(), 194 'post_title' => '02', 195 'post_date' => '2015-02-01 01:00:00', 196 ) ); 208 $id = self::factory()->post->create( 209 array( 210 'post_author' => $this->author_id, 211 'post_status' => 'publish', 212 'post_content' => rand_str(), 213 'post_title' => '02', 214 'post_date' => '2015-02-01 01:00:00', 215 ) 216 ); 197 217 198 218 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); … … 202 222 $this->set_permalink_structure( '/%year%/%postname%/' ); 203 223 204 $id = self::factory()->post->create( array( 205 'post_author' => $this->author_id, 206 'post_status' => 'publish', 207 'post_content' => rand_str(), 208 'post_title' => '2', 209 'post_date' => '2015-02-01 01:00:00', 210 ) ); 224 $id = self::factory()->post->create( 225 array( 226 'post_author' => $this->author_id, 227 'post_status' => 'publish', 228 'post_content' => rand_str(), 229 'post_title' => '2', 230 'post_date' => '2015-02-01 01:00:00', 231 ) 232 ); 211 233 212 234 $this->go_to( get_permalink( $id ) ); … … 218 240 $this->set_permalink_structure( '/%year%/%postname%/' ); 219 241 220 $id = self::factory()->post->create( array( 221 'post_author' => $this->author_id, 222 'post_status' => 'publish', 223 'post_content' => rand_str(), 224 'post_title' => '2', 225 'post_date' => '2015-02-01 01:00:00', 226 ) ); 242 $id = self::factory()->post->create( 243 array( 244 'post_author' => $this->author_id, 245 'post_status' => 'publish', 246 'post_content' => rand_str(), 247 'post_title' => '2', 248 'post_date' => '2015-02-01 01:00:00', 249 ) 250 ); 227 251 228 252 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); … … 232 256 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 233 257 234 $id = self::factory()->post->create( array( 235 'post_author' => $this->author_id, 236 'post_status' => 'publish', 237 'post_content' => rand_str(), 238 'post_title' => '', 239 'post_name' => '01', 240 'post_date' => '2015-02-01 01:00:00', 241 ) ); 258 $id = self::factory()->post->create( 259 array( 260 'post_author' => $this->author_id, 261 'post_status' => 'publish', 262 'post_content' => rand_str(), 263 'post_title' => '', 264 'post_name' => '01', 265 'post_date' => '2015-02-01 01:00:00', 266 ) 267 ); 242 268 243 269 $this->go_to( get_permalink( $id ) ); … … 249 275 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 250 276 251 $id = self::factory()->post->create( array( 252 'post_author' => $this->author_id, 253 'post_status' => 'publish', 254 'post_content' => rand_str(), 255 'post_title' => '', 256 'post_name' => '01', 257 'post_date' => '2015-02-01 01:00:00', 258 ) ); 277 $id = self::factory()->post->create( 278 array( 279 'post_author' => $this->author_id, 280 'post_status' => 'publish', 281 'post_content' => rand_str(), 282 'post_title' => '', 283 'post_name' => '01', 284 'post_date' => '2015-02-01 01:00:00', 285 ) 286 ); 259 287 260 288 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); … … 264 292 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 265 293 266 $id = self::factory()->post->create( array( 267 'post_author' => $this->author_id, 268 'post_status' => 'publish', 269 'post_content' => rand_str(), 270 'post_title' => '01', 271 'post_date' => '2015-02-01 01:00:00', 272 ) ); 294 $id = self::factory()->post->create( 295 array( 296 'post_author' => $this->author_id, 297 'post_status' => 'publish', 298 'post_content' => rand_str(), 299 'post_title' => '01', 300 'post_date' => '2015-02-01 01:00:00', 301 ) 302 ); 273 303 274 304 $this->go_to( get_permalink( $id ) ); … … 280 310 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 281 311 282 $id = self::factory()->post->create( array( 283 'post_author' => $this->author_id, 284 'post_status' => 'publish', 285 'post_content' => rand_str(), 286 'post_title' => '01', 287 'post_date' => '2015-02-01 01:00:00', 288 ) ); 312 $id = self::factory()->post->create( 313 array( 314 'post_author' => $this->author_id, 315 'post_status' => 'publish', 316 'post_content' => rand_str(), 317 'post_title' => '01', 318 'post_date' => '2015-02-01 01:00:00', 319 ) 320 ); 289 321 290 322 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); … … 294 326 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 295 327 296 $id = self::factory()->post->create( array( 297 'post_author' => $this->author_id, 298 'post_status' => 'publish', 299 'post_content' => rand_str(), 300 'post_title' => '01', 301 'post_date' => '2015-02-01 01:00:00', 302 ) ); 303 304 $q = new WP_Query( array( 305 'year' => '2015', 306 'monthnum' => '02', 307 'day' => '01', 308 ) ); 328 $id = self::factory()->post->create( 329 array( 330 'post_author' => $this->author_id, 331 'post_status' => 'publish', 332 'post_content' => rand_str(), 333 'post_title' => '01', 334 'post_date' => '2015-02-01 01:00:00', 335 ) 336 ); 337 338 $q = new WP_Query( 339 array( 340 'year' => '2015', 341 'monthnum' => '02', 342 'day' => '01', 343 ) 344 ); 309 345 310 346 $this->assertTrue( $q->is_day ); … … 316 352 317 353 // Make sure a post is published in 2013/02, to avoid 404s. 318 self::factory()->post->create( array( 319 'post_author' => $this->author_id, 320 'post_status' => 'publish', 321 'post_content' => 'foo', 322 'post_title' => 'bar', 323 'post_date' => '2013-02-01 01:00:00', 324 ) ); 325 326 $id = self::factory()->post->create( array( 327 'post_author' => $this->author_id, 328 'post_status' => 'publish', 329 'post_content' => 'foo', 330 'post_title' => '02', 331 'post_date' => '2015-02-01 01:00:00', 332 ) ); 354 self::factory()->post->create( 355 array( 356 'post_author' => $this->author_id, 357 'post_status' => 'publish', 358 'post_content' => 'foo', 359 'post_title' => 'bar', 360 'post_date' => '2013-02-01 01:00:00', 361 ) 362 ); 363 364 $id = self::factory()->post->create( 365 array( 366 'post_author' => $this->author_id, 367 'post_status' => 'publish', 368 'post_content' => 'foo', 369 'post_title' => '02', 370 'post_date' => '2015-02-01 01:00:00', 371 ) 372 ); 333 373 334 374 $permalink = get_permalink( $id ); … … 344 384 345 385 // Make sure a post is published on 2015/01/01, to avoid 404s. 346 self::factory()->post->create( array( 347 'post_author' => $this->author_id, 348 'post_status' => 'publish', 349 'post_content' => 'foo', 350 'post_title' => 'bar', 351 'post_date' => '2015-01-02 01:00:00', 352 ) ); 353 354 $id = self::factory()->post->create( array( 355 'post_author' => $this->author_id, 356 'post_status' => 'publish', 357 'post_content' => 'foo', 358 'post_title' => '02', 359 'post_date' => '2015-02-02 01:00:00', 360 ) ); 386 self::factory()->post->create( 387 array( 388 'post_author' => $this->author_id, 389 'post_status' => 'publish', 390 'post_content' => 'foo', 391 'post_title' => 'bar', 392 'post_date' => '2015-01-02 01:00:00', 393 ) 394 ); 395 396 $id = self::factory()->post->create( 397 array( 398 'post_author' => $this->author_id, 399 'post_status' => 'publish', 400 'post_content' => 'foo', 401 'post_title' => '02', 402 'post_date' => '2015-02-02 01:00:00', 403 ) 404 ); 361 405 362 406 $permalink = get_permalink( $id ); … … 371 415 $this->set_permalink_structure( '/%year%/%postname%/' ); 372 416 373 $id = self::factory()->post->create( array( 374 'post_author' => $this->author_id, 375 'post_status' => 'publish', 376 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3', 377 'post_title' => '02', 378 'post_date' => '2015-02-01 01:00:00', 379 ) ); 417 $id = self::factory()->post->create( 418 array( 419 'post_author' => $this->author_id, 420 'post_status' => 'publish', 421 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3', 422 'post_title' => '02', 423 'post_date' => '2015-02-01 01:00:00', 424 ) 425 ); 380 426 381 427 $this->go_to( get_permalink( $id ) . '1' ); … … 387 433 $this->set_permalink_structure( '/%year%/%postname%/' ); 388 434 389 $id = self::factory()->post->create( array( 390 'post_author' => $this->author_id, 391 'post_status' => 'publish', 392 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3', 393 'post_title' => '02', 394 'post_date' => '2015-02-05 01:00:00', 395 ) ); 435 $id = self::factory()->post->create( 436 array( 437 'post_author' => $this->author_id, 438 'post_status' => 'publish', 439 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3', 440 'post_title' => '02', 441 'post_date' => '2015-02-05 01:00:00', 442 ) 443 ); 396 444 397 445 $this->go_to( get_permalink( $id ) . '5' ); … … 403 451 $this->set_permalink_structure( '/%year%/%postname%/' ); 404 452 405 $id = self::factory()->post->create( array( 406 'post_author' => $this->author_id, 407 'post_status' => 'publish', 408 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3', 409 'post_title' => '02', 410 'post_date' => '2015-02-05 01:00:00', 411 ) ); 453 $id = self::factory()->post->create( 454 array( 455 'post_author' => $this->author_id, 456 'post_status' => 'publish', 457 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3', 458 'post_title' => '02', 459 'post_date' => '2015-02-05 01:00:00', 460 ) 461 ); 412 462 413 463 $this->go_to( get_permalink( $id ) ); … … 420 470 $this->set_permalink_structure( '/%year%/%postname%/' ); 421 471 422 $id = self::factory()->post->create( array( 423 'post_author' => $this->author_id, 424 'post_status' => 'publish', 425 'post_content' => 'This post does not have pagination.', 426 'post_title' => '02', 427 'post_date' => '2015-02-05 01:00:00', 428 ) ); 472 $id = self::factory()->post->create( 473 array( 474 'post_author' => $this->author_id, 475 'post_status' => 'publish', 476 'post_content' => 'This post does not have pagination.', 477 'post_title' => '02', 478 'post_date' => '2015-02-05 01:00:00', 479 ) 480 ); 429 481 430 482 $this->go_to( get_permalink( $id ) . '5' );
Note: See TracChangeset
for help on using the changeset viewer.