19 declare(strict_types=1);
27 $stateMock = $this->getMockBuilder(ilBuddySystemRelationState::class)->getMock();
30 self::RELATION_OWNER_ID,
31 self::RELATION_OWNER_ID,
35 $this->assertNull(
$relation->getPriorState());
40 $stateMock = $this->getMockBuilder(ilBuddySystemRelationState::class)->getMock();
41 $furtherStateMock = $this->getMockBuilder(ilBuddySystemRelationState::class)->getMock();
42 $finishStateMock = $this->getMockBuilder(ilBuddySystemRelationState::class)->getMock();
43 $stateMock->method(
'link');
47 self::RELATION_OWNER_ID,
48 self::RELATION_OWNER_ID,
53 $this->assertEquals($stateMock,
$relation->getPriorState());
55 $this->assertEquals($stateMock,
$relation->getPriorState());
60 $stateMock = $this->getMockBuilder(ilBuddySystemRelationState::class)->getMock();
64 self::RELATION_OWNER_ID,
65 self::RELATION_OWNER_ID,
71 $this->assertSame(1,
$relation->getUsrId());
74 $this->assertSame(2, $relation->getBuddyUsrId());
76 $relation = $relation->withTimestamp($ts + 1);
77 $this->assertSame($ts + 1, $relation->getTimestamp());
79 $relation = $relation->withIsOwnedByActor(
true);
80 $this->assertTrue($relation->isOwnedByActor());
85 $this->expectException(ilBuddySystemRelationStateException::class);
86 $stateMock = $this->getMockBuilder(ilBuddySystemUnlinkedRelationState::class)->getMock();
89 self::RELATION_OWNER_ID,
90 self::RELATION_OWNER_ID,
95 $expectedRelation = $expectedRelation->withUsrId(self::RELATION_OWNER_ID);
96 $expectedRelation = $expectedRelation->withBuddyUsrId(self::RELATION_OWNER_ID);
98 $expectedRelation->request();
103 $this->expectException(ilBuddySystemRelationStateException::class);
104 $stateMock = $this->getMockBuilder(ilBuddySystemLinkedRelationState::class)->getMock();
107 self::RELATION_OWNER_ID,
108 self::RELATION_OWNER_ID,
112 $expectedRelation = $expectedRelation->withUsrId(self::RELATION_OWNER_ID);
113 $expectedRelation = $expectedRelation->withBuddyUsrId(self::RELATION_OWNER_ID);
115 $expectedRelation->unlink();
120 $this->expectException(ilBuddySystemRelationStateException::class);
121 $stateMock = $this->getMockBuilder(ilBuddySystemRequestedRelationState::class)->getMock();
124 self::RELATION_OWNER_ID,
125 self::RELATION_OWNER_ID,
129 $expectedRelation = $expectedRelation->withUsrId(self::RELATION_OWNER_ID);
130 $expectedRelation = $expectedRelation->withBuddyUsrId(self::RELATION_OWNER_ID);
132 $expectedRelation->link();
137 $this->expectException(ilBuddySystemRelationStateException::class);
138 $stateMock = $this->getMockBuilder(ilBuddySystemRequestedRelationState::class)->getMock();
141 self::RELATION_OWNER_ID,
142 self::RELATION_OWNER_ID,
146 $expectedRelation = $expectedRelation->withUsrId(self::RELATION_OWNER_ID);
147 $expectedRelation = $expectedRelation->withBuddyUsrId(self::RELATION_OWNER_ID);
149 $expectedRelation->ignore();
testUsersAreNotAbleToUnlinkThemselves()
const int RELATION_OWNER_ID
testUsersAreNotAbleToIgnoreThemselves()
testUsersAreNotAbleToRequestThemselves()
testPriorStateCanBeRetrievedAfterSubsequentTransitions()
testPriorStateIsEmptyAfterInstanceWasCreated()
testUsersAreNotAbleToLinkThemselves()
testValuesCanBeFetchedByGettersWhenSetBySetters()