ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilBuddySystemRelationTest Class Reference

Class ilBuddySystemRelationTest. More...

+ Inheritance diagram for ilBuddySystemRelationTest:
+ Collaboration diagram for ilBuddySystemRelationTest:

Public Member Functions

 setUp ()
 
 testPriorStateIsEmptyAfterInstanceWasCreated ()
 
 testPriorStateCanBeRetrievedAfterSubsequentTransitions ()
 
 testValuesCanBeFetchedByGettersWhenSetBySetters ()
 
 testUsersAreNotAbleToRequestThemselves ()
 ilBuddySystemRelationStateException More...
 
 testUsersAreNotAbleToUnlinkThemselves ()
 ilBuddySystemRelationStateException More...
 
 testUsersAreNotAbleToLinkThemselves ()
 ilBuddySystemRelationStateException More...
 
 testUsersAreNotAbleToIgnoreThemselves ()
 ilBuddySystemRelationStateException More...
 

Data Fields

const RELATION_OWNER_ID = -1
 
const RELATION_BUDDY_ID = -2
 

Protected Attributes

 $buddylist
 

Additional Inherited Members

- Protected Member Functions inherited from ilBuddySystemBaseTest
 setGlobalVariable ($name, $value)
 
 assertException ($exception_class)
 

Detailed Description

Class ilBuddySystemRelationTest.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 11 of file ilBuddySystemRelationTest.php.

Member Function Documentation

◆ setUp()

ilBuddySystemRelationTest::setUp ( )

Definition at line 24 of file ilBuddySystemRelationTest.php.

25  {
26  }

◆ testPriorStateCanBeRetrievedAfterSubsequentTransitions()

ilBuddySystemRelationTest::testPriorStateCanBeRetrievedAfterSubsequentTransitions ( )

Definition at line 41 of file ilBuddySystemRelationTest.php.

42  {
43  $state_mock = $this->getMockBuilder('ilBuddySystemRelationState')->getMock();
44  $further_state_mock = $this->getMockBuilder('ilBuddySystemRelationState')->getMock();
45  $finish_state_mock = $this->getMockBuilder('ilBuddySystemRelationState')->getMock();
46  $state_mock->expects($this->any())->method('link');
47 
48  $relation = new ilBuddySystemRelation($state_mock);
49  $relation->setState($further_state_mock);
50  $this->assertEquals($state_mock, $relation->getPriorState());
51  $relation->setState($finish_state_mock);
52  $this->assertEquals($state_mock, $relation->getPriorState());
53  }
Class ilBuddySystemRelation.

◆ testPriorStateIsEmptyAfterInstanceWasCreated()

ilBuddySystemRelationTest::testPriorStateIsEmptyAfterInstanceWasCreated ( )

Definition at line 31 of file ilBuddySystemRelationTest.php.

32  {
33  $state_mock = $this->getMockBuilder('ilBuddySystemRelationState')->getMock();
34  $relation = new ilBuddySystemRelation($state_mock);
35  $this->assertNull($relation->getPriorState());
36  }
Class ilBuddySystemRelation.

◆ testUsersAreNotAbleToIgnoreThemselves()

ilBuddySystemRelationTest::testUsersAreNotAbleToIgnoreThemselves ( )

ilBuddySystemRelationStateException

Definition at line 120 of file ilBuddySystemRelationTest.php.

References ilBuddySystemBaseTest\assertException().

121  {
122  $this->assertException(ilBuddySystemRelationStateException::class);
123  $state_mock = $this->getMockBuilder('ilBuddySystemRequestedRelationState')->getMock();
124  $expected_relation = new ilBuddySystemRelation($state_mock);
125  $expected_relation->setUserId(self::RELATION_OWNER_ID);
126  $expected_relation->setBuddyUserId(self::RELATION_OWNER_ID);
127 
128  $expected_relation->ignore();
129  }
assertException($exception_class)
Class ilBuddySystemRelation.
+ Here is the call graph for this function:

◆ testUsersAreNotAbleToLinkThemselves()

ilBuddySystemRelationTest::testUsersAreNotAbleToLinkThemselves ( )

ilBuddySystemRelationStateException

Definition at line 106 of file ilBuddySystemRelationTest.php.

References ilBuddySystemBaseTest\assertException().

107  {
108  $this->assertException(ilBuddySystemRelationStateException::class);
109  $state_mock = $this->getMockBuilder('ilBuddySystemRequestedRelationState')->getMock();
110  $expected_relation = new ilBuddySystemRelation($state_mock);
111  $expected_relation->setUserId(self::RELATION_OWNER_ID);
112  $expected_relation->setBuddyUserId(self::RELATION_OWNER_ID);
113 
114  $expected_relation->link();
115  }
assertException($exception_class)
Class ilBuddySystemRelation.
+ Here is the call graph for this function:

◆ testUsersAreNotAbleToRequestThemselves()

ilBuddySystemRelationTest::testUsersAreNotAbleToRequestThemselves ( )

ilBuddySystemRelationStateException

Definition at line 77 of file ilBuddySystemRelationTest.php.

References ilBuddySystemBaseTest\assertException().

78  {
79  $this->assertException(ilBuddySystemRelationStateException::class);
80  $state_mock = $this->getMockBuilder('ilBuddySystemUnlinkedRelationState')->getMock();
81  $expected_relation = new ilBuddySystemRelation($state_mock);
82 
83  $expected_relation->setUserId(self::RELATION_OWNER_ID);
84  $expected_relation->setBuddyUserId(self::RELATION_OWNER_ID);
85 
86  $expected_relation->request();
87  }
assertException($exception_class)
Class ilBuddySystemRelation.
+ Here is the call graph for this function:

◆ testUsersAreNotAbleToUnlinkThemselves()

ilBuddySystemRelationTest::testUsersAreNotAbleToUnlinkThemselves ( )

ilBuddySystemRelationStateException

Definition at line 92 of file ilBuddySystemRelationTest.php.

References ilBuddySystemBaseTest\assertException().

93  {
94  $this->assertException(ilBuddySystemRelationStateException::class);
95  $state_mock = $this->getMockBuilder('ilBuddySystemLinkedRelationState')->getMock();
96  $expected_relation = new ilBuddySystemRelation($state_mock);
97  $expected_relation->setUserId(self::RELATION_OWNER_ID);
98  $expected_relation->setBuddyUserId(self::RELATION_OWNER_ID);
99 
100  $expected_relation->unlink();
101  }
assertException($exception_class)
Class ilBuddySystemRelation.
+ Here is the call graph for this function:

◆ testValuesCanBeFetchedByGettersWhenSetBySetters()

ilBuddySystemRelationTest::testValuesCanBeFetchedByGettersWhenSetBySetters ( )

Definition at line 58 of file ilBuddySystemRelationTest.php.

References time.

59  {
60  $state_mock = $this->getMockBuilder('ilBuddySystemRelationState')->getMock();
61  $relation = new ilBuddySystemRelation($state_mock);
62 
63  $relation->setUserId(1);
64  $this->assertEquals(1, $relation->getUserId());
65 
66  $relation->setBuddyUserId(2);
67  $this->assertEquals(2, $relation->getBuddyUserId());
68 
69  $ts = time();
70  $relation->setTimestamp($ts);
71  $this->assertEquals($ts, $relation->getTimestamp());
72  }
Class ilBuddySystemRelation.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

Field Documentation

◆ $buddylist

ilBuddySystemRelationTest::$buddylist
protected

Definition at line 19 of file ilBuddySystemRelationTest.php.

◆ RELATION_BUDDY_ID

const ilBuddySystemRelationTest::RELATION_BUDDY_ID = -2

Definition at line 14 of file ilBuddySystemRelationTest.php.

◆ RELATION_OWNER_ID

const ilBuddySystemRelationTest::RELATION_OWNER_ID = -1

Definition at line 13 of file ilBuddySystemRelationTest.php.


The documentation for this class was generated from the following file: