1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8/**
9 * @group unit
10 *
11 */
12
13class Transition_AtMostTest extends PHPUnit_Framework_TestCase
14{
15	function testOver()
16	{
17		$transition = new Tiki_Transition('A', 'B');
18		$transition->setStates(['A', 'C', 'D', 'F']);
19		$transition->addGuard('atMost', 2, ['C', 'D', 'E', 'F', 'G']);
20
21		$this->assertEquals(
22			[['class' => 'extra', 'count' => 1, 'set' => ['C', 'D', 'F']],],
23			$transition->explain()
24		);
25	}
26
27	function testRightOn()
28	{
29		$transition = new Tiki_Transition('A', 'B');
30		$transition->setStates(['A', 'C', 'D', 'F']);
31		$transition->addGuard('atMost', 3, ['C', 'D', 'E', 'F', 'G']);
32
33		$this->assertEquals([], $transition->explain());
34	}
35
36	function testUnder()
37	{
38		$transition = new Tiki_Transition('A', 'B');
39		$transition->setStates(['A', 'C', 'D', 'F']);
40		$transition->addGuard('atMost', 4, ['C', 'D', 'E', 'F', 'G']);
41
42		$this->assertEquals([], $transition->explain());
43	}
44}
45