Update AddOn Studienplatzverwaltung

This commit is contained in:
Werner Masik
2014-11-20 17:28:32 +00:00
parent 65f8993334
commit 7bc35de303
8 changed files with 443 additions and 7 deletions
@@ -96,7 +96,21 @@ class AqaClientTest extends PHPUnit_Framework_TestCase
$client = new AqaFoebisClient();
$result = $client->listFoebisAbrechnungStudiengang($stgKz,$studjahrCode,$runde);
}
public function testPersonClient() {
$personKz = '1110256020';
$client = new AqaFoebisClient();
$result = $client->listFoebisAbrechnungPerson($personKz);
}
public function testSemesterClient() {
$stgKz = 256;
$semester = 'WS2013';
$client = new AqaFoebisClient();
$result = $client->listFoebisAbrechnungSemester($stgKz, $semester);
$this->assertTrue($result);
}
public function testSyncAll() {
$client = StudienplatzverwaltungAPI::init();
@@ -0,0 +1,126 @@
<?php
/*
* AqaFoebisPersonTest.php
*
* Copyright 2014 fhcomplete.org
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
* Authors: Werner Masik <werner.masik@gefi.at>
*
*/
require_once('../../../../config/system.config.inc.php');
require_once('../../../../include/studienplatz.class.php');
require_once('../../../../include/benutzer.class.php');
require_once('../../../../addons/studienplatzverwaltung/include/aqa_foebis_person.class.php');
class AqaFoebisPersonTest extends PHPUnit_Framework_TestCase
{
protected $benutzer;
protected $uid = 'unittest';
public function setUp()
{
$this->benutzer = new benutzer();
$this->benutzer->new = true;
$this->benutzer->uid = $this->uid;
$this->benutzer->alias = 'Unit Test Benutzer';
$this->benutzer->aktiv = true;
$this->benutzer->nachname = 'Unit';
$this->benutzer->geschlecht = 'm';
$result = $this->benutzer->save();
if (!$result) {
echo 'Fehler: '.$this->benutzer->errormsg;
}
$this->assertTrue($result);
}
public function tearDown()
{
if ($this->benutzer) {
// Benutzer löschen
$this->assertTrue(
$this->benutzer->deleteBenutzer($this->uid));
// Person löschen
$this->assertTrue(
$this->benutzer->delete($this->benutzer->person_id));
// benutzer hat On Delete Restrict zu den appdaten!!!
}
}
public function testCRUD()
{
$matrikelnr = '012342343245';
$studiengang_kz = '120'; // 120 = dummy
$studiensemester_kurzbz = 'WS2014';
$orgform_kurzbz = 'BB';
$regelstudiendauer = 6;
$ausbildungssemester = 2;
$guthaben = 34;
$gefoerdert = 1;
$maxguthaben = 46;
$stud_status = 1;
$meldedatum = mktime(0, 0, 0, 10, 14, 2014);
$insertvon = 'unittest';
// Create
$foebis = new aqa_foebis_person();
$foebis->matrikelnr = $matrikelnr;
$foebis->studiengang_kz = $studiengang_kz;
$foebis->studiensemester_kurzbz = $studiensemester_kurzbz;
$foebis->orgform_kurzbz = $orgform_kurzbz;
$foebis->regelstudiendauer = $regelstudiendauer;
$foebis->ausbildungssemester = $ausbildungssemester;
$foebis->guthaben = $guthaben;
$foebis->gefoerdert = $gefoerdert;
$foebis->maxguthaben = $maxguthaben;
$foebis->stud_status = $stud_status;
$foebis->meldedatum = $meldedatum;
$foebis->insertvon = $insertvon;
$foebis_person_id = $foebis->save();
$this->assertNotEquals($foebis_person_id, false);
// load
$this->assertTrue($foebis->load_foebis($foebis_person_id));
$this->assertEquals($studiengang_kz,$foebis->studiengang_kz);
$this->assertEquals($studiensemester_kurzbz,$foebis->studiensemester_kurzbz);
$this->assertEquals($orgform_kurzbz,$foebis->orgform_kurzbz);
$this->assertEquals($regelstudiendauer,$foebis->regelstudiendauer);
$this->assertEquals($ausbildungssemester,$foebis->ausbildungssemester);
$this->assertEquals($guthaben,$foebis->guthaben);
$this->assertEquals($gefoerdert,$foebis->gefoerdert);
$this->assertEquals($maxguthaben,$foebis->maxguthaben);
$this->assertEquals($stud_status,$foebis->stud_status);
$this->assertEquals($meldedatum, $foebis->meldedatum);
$guthabenNeu = 28;
$foebis->guthaben = $guthabenNeu;
$foebis->save();
$this->assertTrue($foebis->load_foebis($foebis_person_id));
$this->assertEquals($guthabenNeu,$foebis->guthaben);
// test delete + cleanup test data
$this->assertNotEquals($foebis->delete($foebis_person_id), false);
}
}
?>
@@ -0,0 +1,52 @@
<?php
/* Copyright (C) 2006 Technikum-Wien
*
* 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 the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors: Werner Masik <werner@gefi.at>,
*/
require_once('../../../../addons/studienplatzverwaltung/include/functions.inc.php');
class FunctionsTest extends PHPUnit_Framework_TestCase
{
public function setUp()
{
}
public function testFormatStudiengangKz()
{
$this->assertEquals('0227',formatStudiengangKz(227));
}
public function testSemester2BISDatum()
{
$this->assertEquals('15.11.2013',semester2BISDatum('WS2013'));
$this->assertEquals('15.04.2014',semester2BISDatum('SS2014'));
}
public function testBisDatum2Semester()
{
date_default_timezone_set('UTC');
$datum = mktime(0,0,0,11,15,2013);
$this->assertEquals('WS2013',bisDatum2Semester($datum));
$datum = mktime(0,0,0,4,15,2013);
$this->assertEquals('SS2013',bisDatum2Semester($datum));
}
}
?>
@@ -90,6 +90,16 @@ class StudienplatzverwaltungAPITest extends PHPUnit_Framework_TestCase
printf($result);
}
public function testExportCSV()
{
$api = StudienplatzverwaltungAPI::init();
$appdaten = $api->newUV('2013/14',3, $this->uid);
$this->assertNotNull($appdaten);
$result = $api->exportCSV('2013/14',1, $this->uid);
printf($result);
}
public function testGetInfoData()
{