File: tests/util-tests/HttpStatusTest.php

Recommend this page to a friend!
  Classes of Maik Greubel  >  PHP Generics  >  tests/util-tests/HttpStatusTest.php  >  Download  
File: tests/util-tests/HttpStatusTest.php
Role: Unit test script
Content type: text/plain
Description: HttpStatus class test
Class: PHP Generics
Framework for accessing streams, sockets and logs
Author: By
Last change: Update to PHPUnit 6
Date: 3 years ago
Size: 684 bytes
 

Contents

Class file image Download
<?php
namespace Generics\Tests;

use
Generics\Client\HttpStatus;

class
HttpStatusTest extends \PHPUnit\Framework\TestCase
{
    public function
testHttpStatusSimple()
    {
       
$status = HttpStatus::getStatus(200);

       
$this->assertEquals('OK', $status);
    }

    public function
testHttpStatusParser()
    {
       
$statLine = 'HTTP/1.1 500 Internal Server Error';
       
$status = HttpStatus::parseStatus($statLine);

       
$this->assertEquals(500, $status->getCode());
       
$this->assertEquals('HTTP/1.1', $status->getProtocol());
       
$this->assertEquals($statLine, $status->toStatusLine());

       
$this->assertEquals($statLine, strval($status));
    }
}


For more information send a message to info at phpclasses dot org.