Make WordPress Core

Ticket #48845: 48845.patch

File 48845.patch, 1.0 KB (added by pbearne, 7 years ago)
  • tests/phpunit/tests/functions/wpRemoteFopen.php

     
     1<?php
     2/**
     3 * wordpress-develop.
     4 * User: Paul
     5 * Date: 2019-11-30
     6 *
     7 */
     8
     9if ( ! defined( 'WPINC' ) ) {
     10        die;
     11}
     12/**
     13 * @group external-http
     14 */
     15class Tests_wp_remote_fopen extends WP_UnitTestCase {
     16
     17        public function test_wp_remote_fopen_empty() {
     18
     19                $this->assertFalse( wp_remote_fopen('') );
     20        }
     21
     22        public function test_wp_remote_fopen_bad_url() {
     23
     24                $this->assertFalse( wp_remote_fopen('wp.com') );
     25        }
     26
     27        public function test_wp_remote_fopen() {
     28                // this url give a direct 200 response
     29                $url      = 'https://asdftestblog1.wordpress.com/404';
     30                $response = wp_remote_fopen( $url );
     31
     32                $this->assertInternalType( 'string', $response );
     33                $this->assertRegexp( '/<!DOCTYPE html>/', $response );
     34        }
     35}
     36 No newline at end of file