Unit test fixes

This commit is contained in:
Dennis Eichhorn 2016-04-22 17:44:28 +02:00
parent 6323244d9e
commit ea20567ec1
4 changed files with 59 additions and 5 deletions

View File

@ -15,6 +15,7 @@
*/ */
namespace Modules\Calendar\Models; namespace Modules\Calendar\Models;
use Modules\Calendar\Models\EventMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract; use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\Query\Column; use phpOMS\DataStorage\Database\Query\Column;
@ -56,8 +57,8 @@ class CalendarMapper extends DataMapperAbstract
*/ */
protected static $hasMany = [ protected static $hasMany = [
'events' => [ 'events' => [
'mapper' => \Modules\Calendar\Models\EventMapper::class 'mapper' => EventMapper::class,
'relationmapper' => \Modules\Calendar\Models\EventMapper::class 'relationmapper' => EventMapper::class,
'table' => 'calendar_event', 'table' => 'calendar_event',
'dst' => 'calendar_event_calendar', 'dst' => 'calendar_event_calendar',
'src' => null, 'src' => null,
@ -121,8 +122,6 @@ class CalendarMapper extends DataMapperAbstract
$this->db->con->prepare($query->toSql())->execute(); $this->db->con->prepare($query->toSql())->execute();
} catch (\Exception $e) { } catch (\Exception $e) {
var_dump($e->getMessage());
return false; return false;
} }

View File

@ -83,6 +83,16 @@ class Event
*/ */
private $type = EventType::SINGLE; private $type = EventType::SINGLE;
/**
* Event status.
*
* Active, inactive etc.
*
* @var int
* @since 1.0.0
*/
private $status = EventStatus::ACTIVE;
/** /**
* Schedule * Schedule
* *
@ -335,6 +345,17 @@ class Event
return $this->type; return $this->type;
} }
/**
* @return int
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function getStatus() : int
{
return $this->status;
}
/** /**
* @param int $calendar Calendar * @param int $calendar Calendar
* *

View File

@ -60,7 +60,7 @@ class EventMapper extends DataMapperAbstract
*/ */
protected static $hasOne = [ protected static $hasOne = [
'schedule' => [ 'schedule' => [
'mapper' => \Modules\Calendar\Models\ScheduleMapper::class, 'mapper' => ScheduleMapper::class,
'src' => 'calendar_event_schedule', 'src' => 'calendar_event_schedule',
], ],
]; ];

34
Models/EventStatus.php Normal file
View File

@ -0,0 +1,34 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Calendar\Models;
use phpOMS\Datatypes\Enum;
/**
* Event type enum.
*
* @category Calendar
* @package Modules
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
abstract class EventStatus extends Enum
{
const ACTIVE = 1;
}