From 50d472e96d442eb7407ba46ce70fd80a42c5fb84 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 26 Apr 2017 19:25:12 +0200 Subject: [PATCH] new type API --- lam/tests/lib/typesTest.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lam/tests/lib/typesTest.php b/lam/tests/lib/typesTest.php index 38941ffa..cffa41a4 100644 --- a/lam/tests/lib/typesTest.php +++ b/lam/tests/lib/typesTest.php @@ -3,7 +3,7 @@ $Id$ This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) - Copyright (C) 2016 Roland Gruber + Copyright (C) 2016 - 2017 Roland Gruber 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 @@ -31,14 +31,22 @@ require_once 'lam/lib/types.inc'; */ class ListAttributeTest extends PHPUnit_Framework_TestCase { + private $type; + + public function setUp() { + $this->type = $this->getMockBuilder('ConfiguredType')->setMethods(array('getBaseType'))->getMock(); + $scope = new user($this->type); + $this->type->method('getBaseType')->willReturn($scope); + } + public function testPreTranslated() { - $attr = new \LAM\TYPES\ListAttribute('#uid', 'user'); + $attr = new \LAM\TYPES\ListAttribute('#uid', $this->type); $this->assertEquals('User name', $attr->getAlias()); $this->assertEquals('uid', $attr->getAttributeName()); } public function testCustomAlias() { - $attr = new \LAM\TYPES\ListAttribute('uid:My translation', 'user'); + $attr = new \LAM\TYPES\ListAttribute('uid:My translation', $this->type); $this->assertEquals('My translation', $attr->getAlias()); $this->assertEquals('uid', $attr->getAttributeName()); }