ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilBuddySystemRelationStateInitiatorShouldNotBeAbleToApproveIgnoredRequestRuleTestCase.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 public function testConstruct(): void
26 {
27 $relation = $this->getMockBuilder(ilBuddySystemRelation::class)->disableOriginalConstructor()->getMock();
28 $this->assertInstanceOf(
29 DontApprove::class,
30 new DontApprove($relation)
31 );
32 }
33
34 public function testMatches(): void
35 {
36 $relation = $this->getMockBuilder(ilBuddySystemRelation::class)->disableOriginalConstructor()->getMock();
37 $relation->expects($this->once())->method('isIgnored')->willReturn(true);
38 $relation->expects($this->once())->method('isOwnedByActor')->willReturn(true);
39 $instance = new DontApprove($relation);
40
41 $this->assertTrue($instance->matches());
42 }
43
44 public function testMatchesIgnored(): void
45 {
46 $relation = $this->getMockBuilder(ilBuddySystemRelation::class)->disableOriginalConstructor()->getMock();
47 $relation->expects($this->once())->method('isIgnored')->willReturn(false);
48 $relation->expects($this->never())->method('isOwnedByActor');
49 $instance = new DontApprove($relation);
50
51 $this->assertFalse($instance->matches());
52 }
53
54 public function testMatchesOwned(): void
55 {
56 $relation = $this->getMockBuilder(ilBuddySystemRelation::class)->disableOriginalConstructor()->getMock();
57 $relation->expects($this->once())->method('isIgnored')->willReturn(true);
58 $relation->expects($this->once())->method('isOwnedByActor')->willReturn(false);
59 $instance = new DontApprove($relation);
60
61 $this->assertFalse($instance->matches());
62 }
63
64 public function testInvoke(): void
65 {
66 $relation = $this->getMockBuilder(ilBuddySystemRelation::class)->disableOriginalConstructor()->getMock();
67 $state = $this->getMockBuilder(ilBuddySystemRelationState::class)->disableOriginalConstructor()->getMock();
68
69 $instance = new DontApprove($relation);
70
71 $this->assertTrue($instance($state));
72 }
73
74 public function testInvokeFalse(): void
75 {
76 $relation = $this->getMockBuilder(ilBuddySystemRelation::class)->disableOriginalConstructor()->getMock();
77 $state = $this->getMockBuilder(ilBuddySystemLinkedRelationState::class)->disableOriginalConstructor()->getMock();
78
79 $instance = new DontApprove($relation);
80
81 $this->assertFalse($instance($state));
82 }
83}
$relation