@@ -40,27 +40,59 @@ protected function tearDown(): void
4040 {
4141 }
4242
43- // /**
44- // * @covers \AbraFlexi\Root::uploadCertificate
45- // *
46- // * @todo Implement testuploadCertificate().
47- // */
48- // public function testuploadCertificate(): void
49- // {
50- // $this->assertEquals('', $this->object->uploadCertificate());
51- // // Remove the following lines when you implement this test.
52- // $this->markTestIncomplete('This test has not been implemented yet.');
53- // }
54- //
55- // /**
56- // * @covers \AbraFlexi\Root::companies
57- // *
58- // * @todo Implement testcompanies().
59- // */
60- // public function testcompanies(): void
61- // {
62- // $this->assertEquals('', $this->object->companies());
63- // // Remove the following lines when you implement this test.
64- // $this->markTestIncomplete('This test has not been implemented yet.');
65- // }
43+ /**
44+ * @covers \AbraFlexi\Root::getStatus
45+ */
46+ public function testGetStatus (): void
47+ {
48+ $ mock = $ this ->getMockBuilder (Root::class)
49+ ->onlyMethods (['performRequest ' ])
50+ ->getMock ();
51+
52+ $ response = [
53+ 'status ' => [
54+ 'version ' => '2026.2.2 ' ,
55+ 'licenseName ' => 'FlexiBee Systems s.r.o. ' ,
56+ 'startupTime ' => '2026-02-15T03:55:14.201+01:00 ' ,
57+ 'memoryUsed ' => '5091655184 ' ,
58+ ],
59+ ];
60+
61+ $ mock ->expects ($ this ->once ())
62+ ->method ('performRequest ' )
63+ ->with ('/status.json ' , 'GET ' )
64+ ->willReturn ($ response );
65+
66+ $ result = $ mock ->getStatus ();
67+ $ this ->assertIsArray ($ result );
68+ $ this ->assertArrayHasKey ('version ' , $ result );
69+ $ this ->assertEquals ('2026.2.2 ' , $ result ['version ' ]);
70+ }
71+
72+ /**
73+ * @covers \AbraFlexi\Root::getLicenseInfo
74+ */
75+ public function testGetLicenseInfo (): void
76+ {
77+ $ mock = $ this ->getMockBuilder (Root::class)
78+ ->onlyMethods (['performRequest ' ])
79+ ->getMock ();
80+
81+ $ license = [
82+ '@version ' => '1.0 ' ,
83+ 'id ' => 'advanced-786 ' ,
84+ 'name ' => 'FlexiBee Systems s.r.o. ' ,
85+ 'variant ' => 'premium ' ,
86+ ];
87+
88+ $ mock ->expects ($ this ->once ())
89+ ->method ('performRequest ' )
90+ ->with ('/license.json ' , 'GET ' )
91+ ->willReturn (['license ' => $ license ]);
92+
93+ $ result = $ mock ->getLicenseInfo ();
94+ $ this ->assertIsArray ($ result );
95+ $ this ->assertArrayHasKey ('id ' , $ result );
96+ $ this ->assertEquals ('advanced-786 ' , $ result ['id ' ]);
97+ }
6698}
0 commit comments