19 declare(strict_types=1);
31 $stateMock = $this->getMockBuilder(ilBuddySystemRelationState::class)->getMock();
34 self::RELATION_OWNER_ID,
35 self::RELATION_OWNER_ID,
39 $this->assertNull(
$relation->getPriorState());
44 $stateMock = $this->getMockBuilder(ilBuddySystemRelationState::class)->getMock();
45 $furtherStateMock = $this->getMockBuilder(ilBuddySystemRelationState::class)->getMock();
46 $finishStateMock = $this->getMockBuilder(ilBuddySystemRelationState::class)->getMock();
47 $stateMock->method(
'link');
51 self::RELATION_OWNER_ID,
52 self::RELATION_OWNER_ID,
57 $this->assertEquals($stateMock,
$relation->getPriorState());
59 $this->assertEquals($stateMock,
$relation->getPriorState());
64 $stateMock = $this->getMockBuilder(ilBuddySystemRelationState::class)->getMock();
68 self::RELATION_OWNER_ID,
69 self::RELATION_OWNER_ID,
75 $this->assertSame(1,
$relation->getUsrId());
78 $this->assertSame(2, $relation->getBuddyUsrId());
80 $relation = $relation->withTimestamp($ts + 1);
81 $this->assertSame($ts + 1, $relation->getTimestamp());
83 $relation = $relation->withIsOwnedByActor(
true);
84 $this->assertTrue($relation->isOwnedByActor());
89 $this->expectException(ilBuddySystemRelationStateException::class);
90 $stateMock = $this->getMockBuilder(ilBuddySystemUnlinkedRelationState::class)->getMock();
93 self::RELATION_OWNER_ID,
94 self::RELATION_OWNER_ID,
99 $expectedRelation = $expectedRelation->withUsrId(self::RELATION_OWNER_ID);
100 $expectedRelation = $expectedRelation->withBuddyUsrId(self::RELATION_OWNER_ID);
102 $expectedRelation->request();
107 $this->expectException(ilBuddySystemRelationStateException::class);
108 $stateMock = $this->getMockBuilder(ilBuddySystemLinkedRelationState::class)->getMock();
111 self::RELATION_OWNER_ID,
112 self::RELATION_OWNER_ID,
116 $expectedRelation = $expectedRelation->withUsrId(self::RELATION_OWNER_ID);
117 $expectedRelation = $expectedRelation->withBuddyUsrId(self::RELATION_OWNER_ID);
119 $expectedRelation->unlink();
124 $this->expectException(ilBuddySystemRelationStateException::class);
125 $stateMock = $this->getMockBuilder(ilBuddySystemRequestedRelationState::class)->getMock();
128 self::RELATION_OWNER_ID,
129 self::RELATION_OWNER_ID,
133 $expectedRelation = $expectedRelation->withUsrId(self::RELATION_OWNER_ID);
134 $expectedRelation = $expectedRelation->withBuddyUsrId(self::RELATION_OWNER_ID);
136 $expectedRelation->link();
141 $this->expectException(ilBuddySystemRelationStateException::class);
142 $stateMock = $this->getMockBuilder(ilBuddySystemRequestedRelationState::class)->getMock();
145 self::RELATION_OWNER_ID,
146 self::RELATION_OWNER_ID,
150 $expectedRelation = $expectedRelation->withUsrId(self::RELATION_OWNER_ID);
151 $expectedRelation = $expectedRelation->withBuddyUsrId(self::RELATION_OWNER_ID);
153 $expectedRelation->ignore();
testUsersAreNotAbleToUnlinkThemselves()
Class ilBuddySystemRelationTest.
testUsersAreNotAbleToIgnoreThemselves()
testUsersAreNotAbleToRequestThemselves()
testPriorStateCanBeRetrievedAfterSubsequentTransitions()
testPriorStateIsEmptyAfterInstanceWasCreated()
testUsersAreNotAbleToLinkThemselves()
testValuesCanBeFetchedByGettersWhenSetBySetters()