Changeset 63631
- Timestamp:
- 09/15/2026 09:31:01 PM (2 months ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 1 added
- 3 edited
-
includes/abstract-testcase.php (modified) (3 diffs)
-
tests/admin/exportWp.php (modified) (2 diffs)
-
tests/admin/includesMedia.php (modified) (1 diff)
-
tests/includes/uploadSnapshot.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/abstract-testcase.php
r63592 r63631 120 120 $this->factory = static::factory(); 121 121 122 if ( !self::$ignore_files ) {122 if ( null === self::$ignore_files ) { 123 123 self::$ignore_files = $this->scan_user_uploads(); 124 124 } … … 1585 1585 * 1586 1586 * This method works in tandem with the `set_up()` and `rmdir()` methods: 1587 * - `set_up()` s cans the `uploads` directory before every test, and stores1588 * its contents inside of the `$ignore_files` property.1587 * - `set_up()` stores the initial `uploads` directory snapshot in the 1588 * `$ignore_files` property, including when the directory is empty. 1589 1589 * - `rmdir()` and its helper methods only delete files that are not listed 1590 1590 * in the `$ignore_files` property. If called during `tear_down()` in tests, 1591 * this will only delete files added during the previously run test.1591 * this deletes files added after the initial snapshot. 1592 1592 */ 1593 1593 public function remove_added_uploads() { … … 1626 1626 */ 1627 1627 public function scan_user_uploads() { 1628 static $files = array();1629 if ( ! empty( $files )) {1628 static $files = null; 1629 if ( null !== $files ) { 1630 1630 return $files; 1631 1631 } -
trunk/tests/phpunit/tests/admin/exportWp.php
r62168 r63631 45 45 public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { 46 46 require_once ABSPATH . 'wp-admin/includes/export.php'; 47 $file = DIR_TESTDATA . '/images/test-image.jpg';48 47 49 48 $dataset = array( … … 72 71 $post_data['post_author'] = $factory->user->create( array( 'role' => 'editor' ) ); 73 72 74 $post_id = $factory->post->create( $post_data ); 75 $attachment_id = $factory->attachment->create_upload_object( $file, $post_id ); 73 $post_id = $factory->post->create( $post_data ); 74 75 $attachment_id = $factory->attachment->create( 76 array( 77 'file' => 'test-image.jpg', 78 'post_parent' => $post_id, 79 'post_mime_type' => 'image/jpeg', 80 ) 81 ); 76 82 set_post_thumbnail( $post_id, $attachment_id ); 77 83 -
trunk/tests/phpunit/tests/admin/includesMedia.php
r62978 r63631 11 11 12 12 require_once ABSPATH . 'wp-admin/includes/media.php'; 13 } 14 15 public function tear_down() { 16 $this->remove_added_uploads(); 17 18 parent::tear_down(); 13 19 } 14 20
Note:
See TracChangeset
for help on using the changeset viewer.