1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 20:51:53 +02:00

Initial working files.

This commit is contained in:
Cameron 2018-02-04 18:47:24 -08:00
parent 49f9240465
commit c32696ae42
6 changed files with 115 additions and 1 deletions

View File

@ -1,2 +1,4 @@
# phpunit
# e107 Phpunit Tests
For developmental use with e107 v2.
- Set Custom Working Directory for PHPUNit Test to e107's root.

27
includes/bootstrap.php Normal file
View File

@ -0,0 +1,27 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2018 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
/*
$_E107 = array();
$_E107['cli'] = true;
$_E107['phpunit'] = true;
$_E107['debug'] = true;*/
/*$basepath = realpath(dirname(__FILE__))."../../../";
define('e_PHPUNIT', true);
define('e_ROOT', $basepath);
// require_once($basepath."class2.php");
*/
require_once("class2.php");
// Solution: Set Custom Working Directory for PHPUNit Test.
// eg. D:\Documents\UniServerZ\www\e107v2

20
phpunit.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap = "includes/bootstrap.php"
backupStaticAttributes = "false"
colors = "true"
convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true"
convertWarningsToExceptions = "true"
processIsolation = "false"
stopOnFailure = "true"
syntaxCheck = "false">
<testsuites>
<testsuite name="e107 v2.x Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_ENV" value="testing"/>
</php>
</phpunit>

View File

@ -0,0 +1,21 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2018 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
use PHPUnit\Framework\TestCase;
class e107ConstantsTest extends TestCase
{
public function teste_BASE()
{
// todo
$res = defined('e_BASE');
$this->assertTrue($res);
}
}

22
tests/unit/PathsTest.php Normal file
View File

@ -0,0 +1,22 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2018 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
use PHPUnit\Framework\TestCase;
class e107PathsTest extends TestCase
{
public function testPathToClass2()
{
$res = file_exists("class2.php");
$this->assertTrue($res);
}
}

View File

@ -0,0 +1,22 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2018 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
use PHPUnit\Framework\TestCase;
class XMLClassTest extends TestCase
{
public function testLoadDefaultXMLPreferences()
{
// $config = e_CORE."xml/default_install.xml";
// $ret = e107::getXml()->e107Import($config, 'replace', true, true); // Add core pref values
$this->assertTrue(true);
}
}