PHP Classes

File: tests/http-tests/SessionsTest.php

Recommend this page to a friend!
  Classes of Maik Greubel   PHP Generics   tests/http-tests/SessionsTest.php   Download  
File: tests/http-tests/SessionsTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Generics
Framework for accessing streams, sockets and logs
Author: By
Last change: Update of tests/http-tests/SessionsTest.php
Date: 2 months ago
Size: 811 bytes
 

Contents

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

use
Generics\Client\Session;
use
PHPUnit\Framework\TestCase;
use
ArgumentCountError;
use
TypeError;

class
SessionsTest extends TestCase
{
    public function
testSet()
    {
       
$tempArray = [];
       
$session = new Session($tempArray);

       
$session->put('fump', 'doll');

       
$this->assertArrayHasKey('fump', $tempArray);
       
$this->assertEquals('doll', $tempArray['fump']);
    }

    public function
testNoSessionProvided()
    {
       
$phpVersion = substr(phpversion(), 0, 3);

        if (
$phpVersion === '7.1' || $phpVersion === '7.2') {
           
$this->expectException(ArgumentCountError::class);
        } elseif (
$phpVersion === '7.0') {
           
$this->expectException(TypeError::class);
        }
       
$session = new Session();
    }
}