- Timestamp:
- 11/03/2017 07:44:10 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/testcases/core/class-bp-media-extractor.php
r10223 r11737 144 144 145 145 public function test_extract_multiple_media_types_from_content() { 146 $this->factory->user->create( array( 'user_login' => 'paulgibbs' ) );146 self::factory()->user->create( array( 'user_login' => 'paulgibbs' ) ); 147 147 $media = self::$media_extractor->extract( self::$richtext, BP_Media_Extractor::LINKS | BP_Media_Extractor::MENTIONS ); 148 148 … … 153 153 154 154 public function test_extract_media_from_a_wp_post() { 155 $post_id = $this->factory->post->create( array( 'post_content' => self::$richtext ) );155 $post_id = self::factory()->post->create( array( 'post_content' => self::$richtext ) ); 156 156 $media = self::$media_extractor->extract( get_post( $post_id ), BP_Media_Extractor::LINKS ); 157 157 … … 190 190 191 191 public function test_extract_mentions_from_content_with_activity_enabled() { 192 $this->factory->user->create( array( 'user_login' => 'paulgibbs' ) );192 self::factory()->user->create( array( 'user_login' => 'paulgibbs' ) ); 193 193 $media = self::$media_extractor->extract( self::$richtext, BP_Media_Extractor::MENTIONS ); 194 194 … … 198 198 199 199 public function test_extract_mentions_from_content_with_activity_disabled() { 200 $this->factory->user->create( array( 'user_login' => 'paulgibbs' ) );200 self::factory()->user->create( array( 'user_login' => 'paulgibbs' ) ); 201 201 $was_activity_enabled = false; 202 202 … … 304 304 public function test_extract_images_from_content_with_galleries_variant_no_ids() { 305 305 // To test the [gallery] shortcode, we need to create a post and an attachment. 306 $post_id = $this->factory->post->create( array( 'post_content' => self::$richtext ) );307 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', $post_id, array(306 $post_id = self::factory()->post->create( array( 'post_content' => self::$richtext ) ); 307 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array( 308 308 'post_mime_type' => 'image/jpeg', 309 309 'post_type' => 'attachment' … … 329 329 $attachment_ids[] = $this->fake_attachment_upload( DIR_TESTDATA . '/images/canola.jpg' ); 330 330 $attachment_ids = join( ',', $attachment_ids ); 331 $post_id = $this->factory->post->create( array( 'post_content' => "[gallery ids='{$attachment_ids}']" ) );331 $post_id = self::factory()->post->create( array( 'post_content' => "[gallery ids='{$attachment_ids}']" ) ); 332 332 333 333 // Extract the gallery images. … … 345 345 346 346 public function test_extract_no_images_from_content_with_invalid_galleries_variant_no_ids() { 347 $post_id = $this->factory->post->create( array( 'post_content' => self::$richtext ) );347 $post_id = self::factory()->post->create( array( 'post_content' => self::$richtext ) ); 348 348 $media = self::$media_extractor->extract( self::$richtext, BP_Media_Extractor::IMAGES, array( 349 349 'post' => get_post( $post_id ), … … 356 356 357 357 public function test_extract_no_images_from_content_with_invalid_galleries_variant_ids() { 358 $post_id = $this->factory->post->create( array( 'post_content' => '[gallery ids="117,4529"]' ) );358 $post_id = self::factory()->post->create( array( 'post_content' => '[gallery ids="117,4529"]' ) ); 359 359 $media = self::$media_extractor->extract( '', BP_Media_Extractor::IMAGES, array( 360 360 'post' => get_post( $post_id ), … … 372 372 373 373 public function test_extract_no_images_from_content_with_featured_image() { 374 $post_id = $this->factory->post->create( array( 'post_content' => self::$richtext ) );375 $thumbnail_id = $this->factory->attachment->create_object( 'image.jpg', $post_id, array(374 $post_id = self::factory()->post->create( array( 'post_content' => self::$richtext ) ); 375 $thumbnail_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array( 376 376 'post_mime_type' => 'image/jpeg', 377 377 'post_type' => 'attachment' … … 393 393 394 394 public function test_extract_images_from_content_without_featured_image() { 395 $post_id = $this->factory->post->create( array( 'post_content' => self::$richtext ) );395 $post_id = self::factory()->post->create( array( 'post_content' => self::$richtext ) ); 396 396 $media = self::$media_extractor->extract( '', BP_Media_Extractor::IMAGES, array( 397 397 'post' => get_post( $post_id ),
Note: See TracChangeset
for help on using the changeset viewer.