ILIAS  trunk Revision v12.0_alpha-1329-g1094ddb0c33
ILIAS\StaticURL\Tests\ResponseFactoryTest Class Reference
+ Inheritance diagram for ILIAS\StaticURL\Tests\ResponseFactoryTest:
+ Collaboration diagram for ILIAS\StaticURL\Tests\ResponseFactoryTest:

Public Member Functions

 testCannotReturnsCannotHandle ()
 
 testCannotReachReturnsCannotReach ()
 
 testLoginFirstReturnsCannotReachForLoggedInUser ()
 
 testLoginFirstReturnsMaybeCanHandlerAfterLoginForAnonymous ()
 
 testCanReturnsCanHandleWithURIPathWithoutShift ()
 
 testCanReturnsCanHandleWithURIPathWithShift ()
 

Private Member Functions

 buildContext (bool $logged_in)
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 34 of file ResponseFactoryTest.php.

Member Function Documentation

◆ buildContext()

ILIAS\StaticURL\Tests\ResponseFactoryTest::buildContext ( bool  $logged_in)
private

Definition at line 36 of file ResponseFactoryTest.php.

36 : Context
37 {
38 $user = $this->createMock(\ilObjUser::class);
39 $user->method('isAnonymous')->willReturn(!$logged_in);
40 $user->method('getId')->willReturn($logged_in ? 42 : 0);
41
42 $container = $this->createMock(Container::class);
43 $container->method('user')->willReturn($user);
44
45 return new Context($container);
46 }
$container
@noRector
Definition: wac.php:37

References $container.

Referenced by ILIAS\StaticURL\Tests\ResponseFactoryTest\testCannotReachReturnsCannotReach(), ILIAS\StaticURL\Tests\ResponseFactoryTest\testCannotReturnsCannotHandle(), ILIAS\StaticURL\Tests\ResponseFactoryTest\testCanReturnsCanHandleWithURIPathWithoutShift(), ILIAS\StaticURL\Tests\ResponseFactoryTest\testCanReturnsCanHandleWithURIPathWithShift(), ILIAS\StaticURL\Tests\ResponseFactoryTest\testLoginFirstReturnsCannotReachForLoggedInUser(), and ILIAS\StaticURL\Tests\ResponseFactoryTest\testLoginFirstReturnsMaybeCanHandlerAfterLoginForAnonymous().

+ Here is the caller graph for this function:

◆ testCannotReachReturnsCannotReach()

ILIAS\StaticURL\Tests\ResponseFactoryTest::testCannotReachReturnsCannotReach ( )

Definition at line 56 of file ResponseFactoryTest.php.

56 : void
57 {
58 $response = (new Factory($this->buildContext(true)))->cannotReach();
59
60 $this->assertTrue($response->targetCanBeReached());
61 $this->assertNull($response->getURIPath());
62 }
$response
Definition: xapitoken.php:90

References $response, and ILIAS\StaticURL\Tests\ResponseFactoryTest\buildContext().

+ Here is the call graph for this function:

◆ testCannotReturnsCannotHandle()

ILIAS\StaticURL\Tests\ResponseFactoryTest::testCannotReturnsCannotHandle ( )

Definition at line 48 of file ResponseFactoryTest.php.

48 : void
49 {
50 $response = (new Factory($this->buildContext(true)))->cannot();
51
52 $this->assertFalse($response->targetCanBeReached());
53 $this->assertNull($response->getURIPath());
54 }

References $response, and ILIAS\StaticURL\Tests\ResponseFactoryTest\buildContext().

+ Here is the call graph for this function:

◆ testCanReturnsCanHandleWithURIPathWithoutShift()

ILIAS\StaticURL\Tests\ResponseFactoryTest::testCanReturnsCanHandleWithURIPathWithoutShift ( )

Definition at line 78 of file ResponseFactoryTest.php.

78 : void
79 {
80 $response = (new Factory($this->buildContext(true)))->can('/ilias.php?ref_id=5');
81
82 $this->assertSame('/ilias.php?ref_id=5', $response->getURIPath());
83 $this->assertSame(0, $response->shift());
84 $this->assertTrue($response->targetCanBeReached());
85 }

References $response, and ILIAS\StaticURL\Tests\ResponseFactoryTest\buildContext().

+ Here is the call graph for this function:

◆ testCanReturnsCanHandleWithURIPathWithShift()

ILIAS\StaticURL\Tests\ResponseFactoryTest::testCanReturnsCanHandleWithURIPathWithShift ( )

Definition at line 87 of file ResponseFactoryTest.php.

87 : void
88 {
89 $response = (new Factory($this->buildContext(true)))->can('/ilias.php?ref_id=5', true);
90
91 $this->assertSame(1, $response->shift());
92 }

References $response, and ILIAS\StaticURL\Tests\ResponseFactoryTest\buildContext().

+ Here is the call graph for this function:

◆ testLoginFirstReturnsCannotReachForLoggedInUser()

ILIAS\StaticURL\Tests\ResponseFactoryTest::testLoginFirstReturnsCannotReachForLoggedInUser ( )

Definition at line 64 of file ResponseFactoryTest.php.

64 : void
65 {
66 $response = (new Factory($this->buildContext(true)))->loginFirst();
67
68 $this->assertInstanceOf(CannotReach::class, $response);
69 }

References $response, and ILIAS\StaticURL\Tests\ResponseFactoryTest\buildContext().

+ Here is the call graph for this function:

◆ testLoginFirstReturnsMaybeCanHandlerAfterLoginForAnonymous()

ILIAS\StaticURL\Tests\ResponseFactoryTest::testLoginFirstReturnsMaybeCanHandlerAfterLoginForAnonymous ( )

Definition at line 71 of file ResponseFactoryTest.php.

71 : void
72 {
73 $response = (new Factory($this->buildContext(false)))->loginFirst();
74
75 $this->assertInstanceOf(MaybeCanHandlerAfterLogin::class, $response);
76 }

References $response, and ILIAS\StaticURL\Tests\ResponseFactoryTest\buildContext().

+ Here is the call graph for this function:

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