ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilBuddySystemRelationStateNullFilterRuleTestCase.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
24  {
25  $relation = $this->getMockBuilder(ilBuddySystemRelation::class)->disableOriginalConstructor()->getMock();
27  $this->assertInstanceOf(
28  ilBuddySystemRelationStateNullFilterRule::class,
29  $instance
30  );
31 
32  return $instance;
33  }
34 
38  public function testMatches(ilBuddySystemRelationStateNullFilterRule $instance): void
39  {
40  $this->assertTrue($instance->matches());
41  }
42 
46  public function testInvoke(ilBuddySystemRelationStateNullFilterRule $instance): void
47  {
48  $this->assertTrue($instance($this->getMockBuilder(ilBuddySystemRelationState::class)->disableOriginalConstructor()->getMock()));
49  }
50 
51  public function testGetStates(): void
52  {
53  $relation = $this->getMockBuilder(ilBuddySystemRelation::class)->disableOriginalConstructor()->getMock();
54 
56 
57  $filtered = $this->getMockBuilder(ilBuddySystemRelationStateCollection::class)->disableOriginalConstructor()->getMock();
58 
59  $collection = $this->getMockBuilder(ilBuddySystemRelationStateCollection::class)->disableOriginalConstructor()->getMock();
60  $collection->expects(self::once())->method('filter')->with($instance)->willReturn($filtered);
61 
62  $state = $this->getMockBuilder(ilBuddySystemRelationState::class)->disableOriginalConstructor()->getMock();
63  $state->expects(self::once())->method('getPossibleTargetStates')->willReturn($collection);
64 
65  $relation->expects(self::once())->method('getState')->willReturn($state);
66 
67  $this->assertEquals($filtered, $instance->getStates());
68  }
69 }
$relation
testInvoke(ilBuddySystemRelationStateNullFilterRule $instance)
testConstruct
testMatches(ilBuddySystemRelationStateNullFilterRule $instance)
testConstruct