mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization Follow-up to [47780]. See #51344. git-svn-id: https://develop.svn.wordpress.org/trunk@49327 602fd350-edb4-49c9-b593-d223f7449a82
62 lines
1.9 KiB
PHP
62 lines
1.9 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group post
|
|
* @group ping
|
|
*/
|
|
class Tests_Post_Pings extends WP_UnitTestCase {
|
|
|
|
public function test_returns_to_ping_sites_from_post_id() {
|
|
$post_id = self::factory()->post->create(
|
|
array(
|
|
'to_ping' => 'http://www.example.com
|
|
http://www.otherexample.com',
|
|
)
|
|
);
|
|
$this->assertSame( array( 'http://www.example.com', 'http://www.otherexample.com' ), get_to_ping( $post_id ) );
|
|
}
|
|
|
|
public function test_returns_to_ping_sites_from_post_object() {
|
|
$post_id = self::factory()->post->create(
|
|
array(
|
|
'to_ping' => 'http://www.example.com
|
|
http://www.otherexample.com',
|
|
)
|
|
);
|
|
$post = get_post( $post_id );
|
|
$this->assertSame( array( 'http://www.example.com', 'http://www.otherexample.com' ), get_to_ping( $post ) );
|
|
}
|
|
|
|
public function test_returns_pinged_sites_from_post_id() {
|
|
$post_id = self::factory()->post->create( array( 'pinged' => 'foo bar baz' ) );
|
|
$this->assertSame( array( 'foo', 'bar', 'baz' ), get_pung( $post_id ) );
|
|
}
|
|
|
|
public function test_returns_pinged_sites_from_post_object() {
|
|
$post_id = self::factory()->post->create( array( 'pinged' => 'foo bar baz' ) );
|
|
$post = get_post( $post_id );
|
|
$this->assertSame( array( 'foo', 'bar', 'baz' ), get_pung( $post ) );
|
|
}
|
|
|
|
public function test_add_ping_with_post_id() {
|
|
$post_id = self::factory()->post->create();
|
|
add_ping( $post_id, 'foo' );
|
|
add_ping( $post_id, 'bar' );
|
|
add_ping( $post_id, 'baz' );
|
|
$this->assertSame( array( 'foo', 'bar', 'baz' ), get_pung( $post_id ) );
|
|
}
|
|
|
|
public function test_add_ping_array_with_post_id() {
|
|
$post_id = self::factory()->post->create();
|
|
add_ping( $post_id, array( 'foo', 'bar', 'baz' ) );
|
|
$this->assertSame( array( 'foo', 'bar', 'baz' ), get_pung( $post_id ) );
|
|
}
|
|
|
|
public function test_add_ping_with_post_object() {
|
|
$post_id = self::factory()->post->create();
|
|
$post = get_post( $post_id );
|
|
add_ping( $post, 'foo' );
|
|
$this->assertSame( array( 'foo' ), get_pung( $post_id ) );
|
|
}
|
|
}
|