Make WordPress Core

Ticket #48845: 48845.2.diff

File 48845.2.diff, 877 bytes (added by donmhico, 7 years ago)
  • new file tests/phpunit/tests/functions/wpRemoteFopen.php

    diff --git tests/phpunit/tests/functions/wpRemoteFopen.php tests/phpunit/tests/functions/wpRemoteFopen.php
    new file mode 100644
    index 0000000000..0bf7db156d
    - +  
     1<?php
     2/**
     3 * @group external-http
     4 * @group functions.php
     5 */
     6class Tests_wp_remote_fopen extends WP_UnitTestCase {
     7
     8        public function test_wp_remote_fopen_empty() {
     9                $this->assertFalse( wp_remote_fopen('') );
     10        }
     11
     12        public function test_wp_remote_fopen_bad_url() {
     13                $this->assertFalse( wp_remote_fopen('wp.com') );
     14        }
     15
     16        public function test_wp_remote_fopen() {
     17                // this url give a direct 200 response
     18                $url      = 'https://asdftestblog1.wordpress.com/404';
     19                $response = wp_remote_fopen( $url );
     20
     21                $this->assertInternalType( 'string', $response );
     22                $this->assertRegexp( '/<!DOCTYPE html>/', $response );
     23        }
     24}