updated test cases

This commit is contained in:
Roland Gruber 2019-11-28 21:18:25 +01:00
parent 1535bf4da6
commit 58e15da1a8
16 changed files with 53 additions and 43 deletions

View File

@ -1,8 +1,9 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2018 Roland Gruber Copyright (C) 2018 - 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -28,7 +29,7 @@ include 'lam/templates/3rdParty/pla/lib/functions.php';
* *
* @author Roland Gruber * @author Roland Gruber
*/ */
class PlaFunctionsTest extends PHPUnit_Framework_TestCase { class PlaFunctionsTest extends TestCase {
public function test_masort() { public function test_masort() {
$data = array( $data = array(

View File

@ -1,6 +1,6 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2016 - 2019 Roland Gruber Copyright (C) 2016 - 2019 Roland Gruber
@ -28,7 +28,7 @@ include_once 'lam/tests/utils/configuration.inc';
* *
* @author Roland Gruber * @author Roland Gruber
*/ */
class LAMConfigTest extends PHPUnit_Framework_TestCase { class LAMConfigTest extends TestCase {
/** /**
* *

View File

@ -1,4 +1,5 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2018 - 2019 Roland Gruber Copyright (C) 2018 - 2019 Roland Gruber
@ -27,7 +28,7 @@ include_once __DIR__ . '/../../lib/security.inc';
* *
* @author Roland Gruber * @author Roland Gruber
*/ */
class AccountTest extends PHPUnit_Framework_TestCase { class AccountTest extends TestCase {
/** /**
* Tests unformatShortFormatToSeconds() without characters. * Tests unformatShortFormatToSeconds() without characters.

View File

@ -1,4 +1,5 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2019 Roland Gruber Copyright (C) 2019 Roland Gruber
@ -26,7 +27,7 @@ include_once __DIR__ . '/../../lib/baseModule.inc';
* *
* @author Roland Gruber * @author Roland Gruber
*/ */
class BaseModuleTest extends PHPUnit_Framework_TestCase { class BaseModuleTest extends TestCase {
function setup() { function setup() {
$_SESSION['language'] = 'en_GB.utf8:UTF-8:English (Great Britain)'; $_SESSION['language'] = 'en_GB.utf8:UTF-8:English (Great Britain)';

View File

@ -7,6 +7,7 @@ use LAM\TOOLS\IMPORT_EXPORT\RenameEntryTask;
use LAM\TOOLS\IMPORT_EXPORT\DeleteEntryTask; use LAM\TOOLS\IMPORT_EXPORT\DeleteEntryTask;
use LAM\TOOLS\IMPORT_EXPORT\DeleteAttributesTask; use LAM\TOOLS\IMPORT_EXPORT\DeleteAttributesTask;
use LAM\TOOLS\IMPORT_EXPORT\ReplaceAttributesTask; use LAM\TOOLS\IMPORT_EXPORT\ReplaceAttributesTask;
use PHPUnit\Framework\TestCase;
/* /*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
@ -35,7 +36,7 @@ require_once 'lam/lib/import.inc';
* *
* @author Roland Gruber * @author Roland Gruber
*/ */
class ImporterTest extends PHPUnit_Framework_TestCase { class ImporterTest extends TestCase {
/** /**
* No LDIF at all. * No LDIF at all.
@ -45,7 +46,7 @@ class ImporterTest extends PHPUnit_Framework_TestCase {
"this is no LDIF" "this is no LDIF"
); );
$this->setExpectedException(LAMException::class, 'this is no LDIF'); $this->expectException(LAMException::class, 'this is no LDIF');
$importer = new Importer(); $importer = new Importer();
$importer->getTasks($lines); $importer->getTasks($lines);
@ -59,7 +60,7 @@ class ImporterTest extends PHPUnit_Framework_TestCase {
"version: 3" "version: 3"
); );
$this->setExpectedException(LAMException::class, 'version: 3'); $this->expectException(LAMException::class, 'version: 3');
$importer = new Importer(); $importer = new Importer();
$importer->getTasks($lines); $importer->getTasks($lines);
@ -75,7 +76,7 @@ class ImporterTest extends PHPUnit_Framework_TestCase {
"version: 1" "version: 1"
); );
$this->setExpectedException(LAMException::class); $this->expectException(LAMException::class);
$importer = new Importer(); $importer = new Importer();
$importer->getTasks($lines); $importer->getTasks($lines);
@ -90,7 +91,7 @@ class ImporterTest extends PHPUnit_Framework_TestCase {
"some: data" "some: data"
); );
$this->setExpectedException(LAMException::class); $this->expectException(LAMException::class);
$importer = new Importer(); $importer = new Importer();
$importer->getTasks($lines); $importer->getTasks($lines);
@ -106,7 +107,7 @@ class ImporterTest extends PHPUnit_Framework_TestCase {
"dn: uid=test,dc=example,dc=com" "dn: uid=test,dc=example,dc=com"
); );
$this->setExpectedException(LAMException::class, 'dn: uid=test,dc=example,dc=com'); $this->expectException(LAMException::class, 'dn: uid=test,dc=example,dc=com');
$importer = new Importer(); $importer = new Importer();
$importer->getTasks($lines); $importer->getTasks($lines);
@ -141,7 +142,7 @@ class ImporterTest extends PHPUnit_Framework_TestCase {
"uid: test", "uid: test",
); );
$this->setExpectedException(LAMException::class, 'uid=test,dc=example,dc=com - changeType: invalid'); $this->expectException(LAMException::class, 'uid=test,dc=example,dc=com - changeType: invalid');
$importer = new Importer(); $importer = new Importer();
$tasks = $importer->getTasks($lines); $tasks = $importer->getTasks($lines);
@ -178,7 +179,7 @@ class ImporterTest extends PHPUnit_Framework_TestCase {
"uid: test", "uid: test",
); );
$this->setExpectedException(LAMException::class, 'uid=test,dc=example,dc=com'); $this->expectException(LAMException::class, 'uid=test,dc=example,dc=com');
$importer = new Importer(); $importer = new Importer();
$tasks = $importer->getTasks($lines); $tasks = $importer->getTasks($lines);
@ -197,7 +198,7 @@ class ImporterTest extends PHPUnit_Framework_TestCase {
"deleteoldrdn: x", "deleteoldrdn: x",
); );
$this->setExpectedException(LAMException::class, 'uid=test,dc=example,dc=com'); $this->expectException(LAMException::class, 'uid=test,dc=example,dc=com');
$importer = new Importer(); $importer = new Importer();
$tasks = $importer->getTasks($lines); $tasks = $importer->getTasks($lines);
@ -235,7 +236,7 @@ class ImporterTest extends PHPUnit_Framework_TestCase {
"uid: test", "uid: test",
); );
$this->setExpectedException(LAMException::class, 'uid=test,dc=example,dc=com'); $this->expectException(LAMException::class, 'uid=test,dc=example,dc=com');
$importer = new Importer(); $importer = new Importer();
$tasks = $importer->getTasks($lines); $tasks = $importer->getTasks($lines);
@ -271,7 +272,7 @@ class ImporterTest extends PHPUnit_Framework_TestCase {
"invalid: test", "invalid: test",
); );
$this->setExpectedException(LAMException::class, 'uid=test,dc=example,dc=com'); $this->expectException(LAMException::class, 'uid=test,dc=example,dc=com');
$importer = new Importer(); $importer = new Importer();
$tasks = $importer->getTasks($lines); $tasks = $importer->getTasks($lines);
@ -291,7 +292,7 @@ class ImporterTest extends PHPUnit_Framework_TestCase {
"invalid: uid2" "invalid: uid2"
); );
$this->setExpectedException(LAMException::class, 'uid=test,dc=example,dc=com'); $this->expectException(LAMException::class, 'uid=test,dc=example,dc=com');
$importer = new Importer(); $importer = new Importer();
$tasks = $importer->getTasks($lines); $tasks = $importer->getTasks($lines);

View File

@ -1,7 +1,8 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2018 Roland Gruber Copyright (C) 2018 - 2019 Roland Gruber
*/ */
if (is_readable('lam/lib/modules/bindDLZ.inc')) { if (is_readable('lam/lib/modules/bindDLZ.inc')) {
@ -15,7 +16,7 @@ if (is_readable('lam/lib/modules/bindDLZ.inc')) {
* *
* @author Roland Gruber * @author Roland Gruber
*/ */
class bindDLZTest extends PHPUnit_Framework_TestCase { class bindDLZTest extends TestCase {
public function testIncreaseSerial() { public function testIncreaseSerial() {
$this->assertEquals('1', bindDLZ::increaseSerial('')); $this->assertEquals('1', bindDLZ::increaseSerial(''));

View File

@ -1,7 +1,8 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2017 Roland Gruber Copyright (C) 2017 - 2019 Roland Gruber
*/ */
if (is_readable('lam/lib/modules/customFields.inc')) { if (is_readable('lam/lib/modules/customFields.inc')) {
@ -16,7 +17,7 @@ if (is_readable('lam/lib/modules/customFields.inc')) {
* @author Roland Gruber * @author Roland Gruber
* *
*/ */
class customFieldsConstantEntryTest extends PHPUnit_Framework_TestCase { class customFieldsConstantEntryTest extends TestCase {
public function testReplaceWildcardsSpaces() { public function testReplaceWildcardsSpaces() {
$originalMiddle = '123((uid))456'; $originalMiddle = '123((uid))456';

View File

@ -1,8 +1,9 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2016 - 2018 Roland Gruber Copyright (C) 2016 - 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -33,7 +34,7 @@ if (is_readable('lam/lib/modules/ppolicyUser.inc')) {
* @author Roland Gruber * @author Roland Gruber
* *
*/ */
class PPolicyUserPasswordNotifyJobTest extends PHPUnit_Framework_TestCase { class PPolicyUserPasswordNotifyJobTest extends TestCase {
private $job; private $job;

View File

@ -1,9 +1,9 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2016 Roland Gruber Copyright (C) 2016 - 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -31,7 +31,7 @@ include_once 'lam/lib/modules/sambaSamAccount.inc';
* @author Roland Gruber * @author Roland Gruber
* *
*/ */
class SambaSamAccountTest extends PHPUnit_Framework_TestCase { class SambaSamAccountTest extends TestCase {
public function testValidateHistoryEntry() { public function testValidateHistoryEntry() {
$this->assertFalse(sambaSamAccount::validateHistoryEntry("password", "")); $this->assertFalse(sambaSamAccount::validateHistoryEntry("password", ""));

View File

@ -1,8 +1,9 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2016 - 2018 Roland Gruber Copyright (C) 2016 - 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -32,7 +33,7 @@
* *
* @author Roland Gruber * @author Roland Gruber
*/ */
class ShadowAccountTest extends PHPUnit_Framework_TestCase { class ShadowAccountTest extends TestCase {
public function test_isAccountExpired_noAttr() { public function test_isAccountExpired_noAttr() {
$attrs = array('objectClass' => array('shadowAccount')); $attrs = array('objectClass' => array('shadowAccount'));
@ -122,7 +123,7 @@ if (is_readable('lam/lib/passwordExpirationJob.inc')) {
* @author Roland Gruber * @author Roland Gruber
* *
*/ */
class ShadowAccountPasswordNotifyJobTest extends PHPUnit_Framework_TestCase { class ShadowAccountPasswordNotifyJobTest extends TestCase {
private $job; private $job;

View File

@ -1,9 +1,9 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2014 - 2016 Roland Gruber Copyright (C) 2014 - 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -32,7 +32,7 @@ if (is_readable('lam/lib/modules/sudoRole.inc')) {
* @author Roland Gruber * @author Roland Gruber
* *
*/ */
class SudoRoleTest extends PHPUnit_Framework_TestCase { class SudoRoleTest extends TestCase {
public function testIsValidDate() { public function testIsValidDate() {
$valid = array('22.10.2014', '05.01.2013', '1.3.2014', '10.5.2014', '4.12.2015', $valid = array('22.10.2014', '05.01.2013', '1.3.2014', '10.5.2014', '4.12.2015',

View File

@ -1,9 +1,9 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2017 Roland Gruber Copyright (C) 2017 - 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -30,7 +30,7 @@
* *
* @author Roland Gruber * @author Roland Gruber
*/ */
class WindowsUserTest extends PHPUnit_Framework_TestCase { class WindowsUserTest extends TestCase {
public function test_isAccountExpired_noAttr() { public function test_isAccountExpired_noAttr() {
$attrs = array('objectClass' => array('user')); $attrs = array('objectClass' => array('user'));

View File

@ -4,6 +4,7 @@ use LAM\PDF\PDFEntrySection;
use LAM\PDF\PDFStructureReader; use LAM\PDF\PDFStructureReader;
use LAM\PDF\PDFStructure; use LAM\PDF\PDFStructure;
use LAM\PDF\PDFStructureWriter; use LAM\PDF\PDFStructureWriter;
use PHPUnit\Framework\TestCase;
/* /*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
@ -33,7 +34,7 @@ include_once 'lam/lib/pdfstruct.inc';
* @author Roland Gruber * @author Roland Gruber
* *
*/ */
class ReadStructureTest extends PHPUnit_Framework_TestCase { class ReadStructureTest extends TestCase {
/** /**
* Reads the sample structure. * Reads the sample structure.

View File

@ -1,6 +1,6 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2014 - 2016 Roland Gruber Copyright (C) 2014 - 2016 Roland Gruber
@ -32,7 +32,7 @@ include_once 'lam/lib/security.inc';
* @author Roland Gruber * @author Roland Gruber
* *
*/ */
class SecurityTest extends PHPUnit_Framework_TestCase { class SecurityTest extends TestCase {
private $cfg = null; private $cfg = null;

View File

@ -1,4 +1,5 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
@ -28,7 +29,7 @@ require_once 'lam/lib/selfService.inc';
* @author Roland Gruber * @author Roland Gruber
* *
*/ */
class selfServiceProfileTest extends PHPUnit_Framework_TestCase { class selfServiceProfileTest extends TestCase {
public function testBaseUrl() { public function testBaseUrl() {
$profile = new selfServiceProfile(); $profile = new selfServiceProfile();

View File

@ -1,9 +1,9 @@
<?php <?php
use PHPUnit\Framework\TestCase;
/* /*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2016 - 2017 Roland Gruber Copyright (C) 2016 - 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -29,7 +29,7 @@ require_once 'lam/lib/types.inc';
* @author Roland Gruber * @author Roland Gruber
* *
*/ */
class ListAttributeTest extends PHPUnit_Framework_TestCase { class ListAttributeTest extends TestCase {
private $type; private $type;