altocompta/unit-test/include/class/dossierTest.php

95 lines
2.1 KiB
PHP

<?php
use PHPUnit\Framework\TestCase;
/**
* Generated by PHPUnit_SkeletonGenerator on 2016-02-11 at 15:39:21.
* @coversDefaultClass \Dossier
* @backupGlobals enable
*/
class DossierTest extends TestCase
{
/**
* @var Dossier
*/
protected $object;
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp():void
{
require_once 'global.php';
$this->object=new Dossier(DOSSIER);
}
/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown():void
{
}
/**
* @covers Dossier::synchro_admin
*/
public function testSynchro_admin()
{
Dossier::synchro_admin(DOSSIER);
// nothing to test
$this->assertTrue(true);
}
/**
* @testdox Test Dossier::id()
* @covers ::id
*/
public function testID()
{
$this->assertEquals(DOSSIER,Dossier::id(),"Id() doesn't work");
}
/**
* @testdox Load
*/
public function testLoad()
{
global $g_connection;
$obj=new Dossier(DOSSIER);
$obj->load();
$this->assertEquals(DOSSIER,$obj->get_parameter("id"),"Not the right folder");
}
/**
* @testdox check
*/
public function testCheck()
{
$_REQUEST['gDossier']='14';
\Dossier::check();
$this->assertTrue(true, 'check has failed');
}
/**
* @testdox hidden function
*/
function testHidden()
{
$_REQUEST['gDossier']='14';
$this->assertEquals('<input type="hidden" id="gDossier" name="gDossier" value="14">', \Dossier::hidden());
}
/**
* @testdox get function
*/
function testGet()
{
$_REQUEST['gDossier']='14';
$this->assertEquals('gDossier=14', \Dossier::get());
}
/**
* @testdox set current dossier
*/
function testSetCurrentDossier()
{
\Dossier::set_current(15);
$this->assertEquals(15, \Dossier::id());
}
}