Changeset 34680 for trunk/tests/phpunit/tests/admin/includesPost.php
- Timestamp:
- 09/29/2015 04:02:00 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesPost.php
r34671 r34680 526 526 flush_rewrite_rules(); 527 527 } 528 529 public function test_post_exists_should_match_title() { 530 $p = $this->factory->post->create( array( 531 'post_title' => 'Foo Bar', 532 ) ); 533 534 $this->assertSame( $p, post_exists( 'Foo Bar' ) ); 535 } 536 537 public function test_post_exists_should_not_match_nonexistent_title() { 538 $p = $this->factory->post->create( array( 539 'post_title' => 'Foo Bar', 540 ) ); 541 542 $this->assertSame( 0, post_exists( 'Foo Bar Baz' ) ); 543 } 544 545 public function test_post_exists_should_match_nonempty_content() { 546 $title = 'Foo Bar'; 547 $content = 'Foo Bar Baz'; 548 $p = $this->factory->post->create( array( 549 'post_title' => $title, 550 'post_content' => $content, 551 ) ); 552 553 $this->assertSame( $p, post_exists( $title, $content ) ); 554 } 555 556 public function test_post_exists_should_not_match_when_nonempty_content_doesnt_match() { 557 $title = 'Foo Bar'; 558 $content = 'Foo Bar Baz'; 559 $p = $this->factory->post->create( array( 560 'post_title' => $title, 561 'post_content' => $content . ' Quz', 562 ) ); 563 564 $this->assertSame( 0, post_exists( $title, $content ) ); 565 } 566 567 public function test_post_exists_should_match_nonempty_date() { 568 $title = 'Foo Bar'; 569 $date = '2014-05-08 12:00:00'; 570 $p = $this->factory->post->create( array( 571 'post_title' => $title, 572 'post_date' => $date, 573 ) ); 574 575 $this->assertSame( $p, post_exists( $title, '', $date ) ); 576 } 577 578 public function test_post_exists_should_not_match_when_nonempty_date_doesnt_match() { 579 $title = 'Foo Bar'; 580 $date = '2014-05-08 12:00:00'; 581 $p = $this->factory->post->create( array( 582 'post_title' => $title, 583 'post_date' => '2015-10-10 00:00:00', 584 ) ); 585 586 $this->assertSame( 0, post_exists( $title, '', $date ) ); 587 } 588 589 public function test_post_exists_should_match_nonempty_title_content_and_date() { 590 $title = 'Foo Bar'; 591 $content = 'Foo Bar Baz'; 592 $date = '2014-05-08 12:00:00'; 593 $p = $this->factory->post->create( array( 594 'post_title' => $title, 595 'post_content' => $content, 596 'post_date' => $date, 597 ) ); 598 599 $this->assertSame( $p, post_exists( $title, $content, $date ) ); 600 } 528 601 }
Note: See TracChangeset
for help on using the changeset viewer.