PHP Classes

File: tests/SxTest.php

Recommend this page to a friend!
  Classes of Martin Pircher   Skylable SX PHP Client   tests/SxTest.php   Download  
File: tests/SxTest.php
Role: Unit test script
Content type: text/plain
Description: unit test
Class: Skylable SX PHP Client
Store and retrieve files in Skylable cloud cluster
Author: By
Last change:
Date: 9 years ago
Size: 1,548 bytes
 

Contents

Class file image Download
<?php
/**
 * Skylable SX PHP Client
 *
 * @package skylablesx
 * @author Martin Pircher <mplx+coding@donotreply.at>
 * @copyright Copyright (c) 2014-2015, Martin Pircher
 * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
 **/

namespace mplx\skylablesx\Tests;

use
mplx\skylablesx\Sx;

class
SxTest extends \PHPUnit_Framework_TestCase
{
   
// sx object
   
private $sx = null;

   
// setup sx
   
public function setUp()
    {
       
$this->sx = new Sx();
    }
   
// SetSSL(): empty/invalid data
   
public function testSetSSL()
    {
       
$this->assertTrue($this->sx->setSSL(true, false));
       
$this->assertTrue($this->sx->setSSL(false, true));
       
$this->assertFalse($this->sx->setSSL('invalid', false));
    }

   
// setAuth: empty/invalid data
   
public function testSetAuthEmpty()
    {
       
$this->assertFalse($this->sx->setAuth(''));
       
$this->assertFalse($this->sx->setAuth(null));
       
$this->assertFalse($this->sx->setAuth('invalid!'));
    }

   
// setEndpoint
   
public function testSetEndpoint()
    {
       
$this->assertEquals(
           
'cluster.dummy.tld:80',
           
$this->sx->setEndpoint('cluster.dummy.tld', null)
        );
       
$this->assertEquals(
           
'cluster.dummy.tld:8443',
           
$this->sx->setEndpoint('cluster.dummy.tld', 8443)
        );
    }

   
// setPort
   
public function testSetPort()
    {
       
$this->assertFalse($this->sx->setPort('invalid!'));
       
$this->assertEquals(8443, $this->sx->setPort(8443));
    }
}