summaryrefslogtreecommitdiffstatshomepage
path: root/tests/phpunit/includes/class-wp-sitemaps-test-provider.php
blob: cf980923f1fa5c4dbcdef814be5b46d01b8154fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php

/**
 * Class WP_Sitemaps_Test_Provider.
 *
 * Provides test data for additional registered providers.
 */
class WP_Sitemaps_Test_Provider extends WP_Sitemaps_Provider {
	/**
	 * WP_Sitemaps_Posts constructor.
	 *
	 * @param string $object_type Optional. Object type name to use. Default 'test'.
	 */
	public function __construct( $object_type = 'test' ) {
		$this->object_type = $object_type;
	}

	/**
	 * Return the public post types, which excludes nav_items and similar types.
	 * Attachments are also excluded. This includes custom post types with public = true
	 *
	 * @return array Map of object subtype objects (WP_Post_Type) keyed by their name.
	 */
	public function get_object_subtypes() {
		return array(
			'type-1' => (object) array( 'name' => 'type-1' ),
			'type-2' => (object) array( 'name' => 'type-2' ),
			'type-3' => (object) array( 'name' => 'type-3' ),
		);
	}

	/**
	 * Gets a URL list for a sitemap.
	 *
	 * @param int    $page_num       Page of results.
	 * @param string $object_subtype Optional. Object subtype name. Default empty.
	 * @return array[] Array of URL information for a sitemap.
	 */
	public function get_url_list( $page_num, $object_subtype = '' ) {
		return array();
	}

	/**
	 * Query for determining the number of pages.
	 *
	 * @param string $object_subtype Optional. Object subtype. Default empty.
	 * @return int Total number of pages.
	 */
	public function get_max_num_pages( $object_subtype = '' ) {
		return 4;
	}
}