ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
GetStatusTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\Data\Description\Factory as DescriptionFactory;
25use ILIAS\UI\Component\Input\Factory as InputFactory;
26use PHPUnit\Framework\Attributes\DataProvider;
27use PHPUnit\Framework\TestCase;
28
29class GetStatusTest extends TestCase
30{
31 public function testItIsAQuery(): void
32 {
33 $this->assertSame(ActivityType::Query, (new GetStatus())->getType());
34 }
35
37 {
38 $activity = new GetStatus();
39
40 $this->assertStringContainsString('status', $activity->getDescription()->getRawRepresentation());
41 $this->assertNotNull($activity->getOutputDescription(new DescriptionFactory()));
42 }
43
47 public static function users(): array
48 {
49 return [
50 'nobody' => [0],
51 'the root user' => [6],
52 'somebody' => [42],
53 ];
54 }
55
60 #[DataProvider('users')]
61 public function testNobodyIsAllowedYet(int $usr_id): void
62 {
63 $activity = new GetStatus();
64
65 $this->assertFalse($activity->isAllowedToPerform($usr_id, []));
66
67 $result = $activity->maybePerformAs($this->createStub(InputFactory::class), $usr_id, []);
68
69 $this->assertTrue($result->isError());
70 $this->assertSame(403, $result->error()->getCode());
71 }
72}
testNobodyIsAllowedYet(int $usr_id)
What the setup knows is nothing for everybody with a session - as long as there is no check for admin...
This is a stub: the status of the installation is not collected yet.
Definition: GetStatus.php:41
This is how a factory for inputs looks like.
Definition: Factory.php:27