使WordPress成为核心

变更集58108


忽略:
时间戳:
2024年6月5日下午06:39:15(5个月(之前)
作者:
约十亿
消息:

构建/测试工具:标准化远程HTTP请求测试的断言。

这样可以确保在外部HTTP测试期间,当HTTP请求失败时,显示尽可能多的信息。

修复#61148

位置:
trunk/tests/phpunit/tests
文件夹:
3已编辑

图例:

未修改
补充
远离的
  • trunk/tests/phpunit/tests/http://base.php

    56548兰特 58108兰特  
    220220
    221221$this->skipTestOnTimeout($res);
     222$this->assertNotWPError($res);
    222223$this->assertSame('PASS',wp_remote_retrieve_body($res));
    223224$this->assertNotEmpty($res['headers']['location']);
     
    357358
    358359$this->skipTestOnTimeout($res);
     360$this->assertNotWPError($res);
    359361$this->assertSame($method,wp_remote_retrieve_body($res));
    360362    }
     
    407409
    408410$this->skipTestOnTimeout($res);
     411$this->assertNotWPError($res);
    409412$this->assertSame('PASS',wp_remote_retrieve_body($res));
    410413    }
     
    448451
    449452$this->skipTestOnTimeout($res);
     453$this->assertNotWPError($res);
    450454$this->assertSame('PASS',wp_remote_retrieve_body($res));
    451455    }
  • trunk/tests/phpunit/tests/http/functions.php

    57931兰特 58108兰特  
    1616
    1717$this->skipTestOnTimeout($response);
     18$this->assertNotWPError($response);
    1819
    1920$headers=wp_remote_retrieve_headers($response);
    2021
    2122$this->assertIsArray($response);
    22 
     23$this->assertSame(200,wp_remote_retrieve_response_code($response));
    2324$this->assertSame('image/png',$headers['Content-Type']);
    2425$this->assertSame('153204',$headers['Content-Length']);
    25 $this->assertSame(200,wp_remote_retrieve_response_code($response));
    2626    }
    2727
     
    3535
    3636$this->skipTestOnTimeout($response);
     37$this->assertNotWPError($response);
    3738$this->assertSame(301,wp_remote_trieve_response_code($response));
    3839    }
     
    4647
    4748$this->skipTestOnTimeout($response);
     49$this->assertNotWPError($response);
    4850$this->assertSame(404,wp_remote_retrieve_response_code($response));
    4951    }
     
    6062
    6163$this->skipTestOnTimeout($response);
     64$this->assertNotWPError($response);
    6265
    6366$headers=wp_remote_retrieve_headers($response);
    6467
    65 $this->assertIsArray($response);
    66 
    6768//应返回与HEAD请求相同的标头。
     69$this->assertSame(200,wp_remote_retrieve_response_code($response));
    6870$this->assertSame('image/png',$headers['Content-Type']);
    6971$this->assertSame('153204',$headers['Content-Length']);
    70 $this->assertSame(200,wp_remote_retrieve_response_code($response));
    7172    }
    7273
     
    8384
    8485$this->skipTestOnTimeout($response);
     86$this->assertNotWPError($response);
    8587
    8688$headers=wp_remote_retrieve_headers($response);
    8789
    8890//应返回与HEAD请求相同的标头。
     91$this->assertSame(200,wp_remote_retrieve_response_code($response));
    8992$this->assertSame('image/png',$headers['Content-Type']);
    9093$this->assertSame('153204',$headers['Content-Length']);
    91 $this->assertSame(200,wp_remote_retrieve_response_code($response));
    9294    }
    9395
     
    120122
    121123$this->skipTestOnTimeout($response);
     124$this->assertNotWPError($response);
    122125
    123126$cookies=wp_remote_retrieve_cookies($response);
     
    165168
    166169$this->skipTestOnTimeout($response);
     170$this->assertNotWPError($response);
    167171
    168172$cookies=wp_remote_retrieve_cookies($response);
     
    196200
    197201$this->skipTestOnTimeout($response);
     202$this->assertNotWPError($response);
    198203
    199204$cookies=wp_remote_retrieve_cookies($response);
  • trunk/tests/phpunit/tests/readme.php

    57689兰特 58108兰特  
    9595
    9696$this->skipTestOnTimeout($response);
     97$this->assertNotWPError($response);
    9798
    9899$响应代码=wp_remote_retrieve_response_code($响应);
注:请参见TracChangeset(跟踪变更集)获取有关使用变更集查看器的帮助。