Make WordPress Core

Ticket #61627: wp_get_wp_version-tests.diff

File wp_get_wp_version-tests.diff, 1.1 KB (added by costdev, 10 months ago)

Tests

  • new file tests/phpunit/tests/functions/wpGetWpVersion.php

    diff --git a/tests/phpunit/tests/functions/wpGetWpVersion.php b/tests/phpunit/tests/functions/wpGetWpVersion.php
    new file mode 100644
    index 0000000000..d10d946e3b
    - +  
     1<?php
     2
     3/**
     4 * Tests for wp_get_wp_version().
     5 *
     6 * @group functions
     7 *
     8 * @covers ::wp_get_wp_version
     9 */
     10class Tests_Functions_WpGetWpVersion extends WP_UnitTestCase {
     11
     12        /**
     13         * Tests that the WordPress version is returned.
     14         *
     15         * @ticket 61627
     16         */
     17        public function test_should_return_wp_version() {
     18                $this->assertSame( $GLOBALS['wp_version'], wp_get_wp_version() );
     19        }
     20
     21        /**
     22         * Tests that changes to the `$wp_version` global are ignored.
     23         *
     24         * @ticket 61627
     25         */
     26        public function test_should_ignore_changes_to_wp_version_global() {
     27                $original_wp_version   = $GLOBALS['wp_version'];
     28                $GLOBALS['wp_version'] = 'modified_wp_version';
     29                $actual                = wp_get_wp_version();
     30                $GLOBALS['wp_version'] = $original_wp_version;
     31
     32                $this->assertSame( $original_wp_version, $actual );
     33        }
     34}