-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finalizes Logging and prepares notifications
- Loading branch information
Showing
10 changed files
with
247 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace LoxBerry\Communication; | ||
|
||
/** | ||
* Class Notifications. | ||
*/ | ||
class Notifications | ||
{ | ||
const RETRIEVE_ALL = 'all'; | ||
const RETRIEVE_ERRORS = 'error'; | ||
const RETRIEVE_INFO = 'info'; | ||
|
||
const SEVERITY_LEVEL_INFO = 6; | ||
const SEVERITY_LEVEL_ERROR = 3; | ||
|
||
public function get(): array | ||
{ | ||
} | ||
|
||
public function getHtml(string $type = 'all'): string | ||
{ | ||
} | ||
|
||
public function notify(): bool | ||
{ | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace LoxBerry\Utility; | ||
|
||
use LoxBerry\ConfigurationParser\SystemConfigurationParser; | ||
|
||
/** | ||
* Class AbstractHttpAccess. | ||
*/ | ||
abstract class AbstractHttpAccess | ||
{ | ||
/** @var SystemConfigurationParser */ | ||
protected $systemConfiguration; | ||
|
||
/** | ||
* HttpAccess constructor. | ||
* | ||
* @param SystemConfigurationParser $systemConfiguration | ||
*/ | ||
public function __construct(SystemConfigurationParser $systemConfiguration) | ||
{ | ||
$this->systemConfiguration = $systemConfiguration; | ||
} | ||
|
||
abstract protected function getEndpointUrl(): string; | ||
|
||
/** | ||
* @param array $data | ||
* | ||
* @return false|string | ||
*/ | ||
protected function post(array $data) | ||
{ | ||
$context = stream_context_create([ | ||
'http' => [ | ||
'header' => "Content-type: application/x-www-form-urlencoded\r\n", | ||
'method' => 'POST', | ||
'content' => http_build_query($data), | ||
], | ||
]); | ||
|
||
return file_get_contents($this->getEndpointUrl(), false, $context); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getBaseUrl(): string | ||
{ | ||
return 'http://localhost:'.($this->systemConfiguration->getWebserverPort() ?? 80); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace LoxBerry\Utility\HttpAccess; | ||
|
||
use LoxBerry\Utility\AbstractHttpAccess; | ||
|
||
/** | ||
* Class AjaxNotificationHandler. | ||
*/ | ||
class AjaxNotificationHandler extends AbstractHttpAccess | ||
{ | ||
const ENDPOINT_URL = '/admin/system/tools/ajax-notification-handler.cgi'; | ||
|
||
/** | ||
* @param array $data | ||
* | ||
* @return string | ||
*/ | ||
public function getAsString(array $data): string | ||
{ | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* | ||
* @return array | ||
*/ | ||
public function getAsArray(array $data): array | ||
{ | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function getEndpointUrl(): string | ||
{ | ||
return $this->getBaseUrl().self::ENDPOINT_URL; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace LoxBerry\Tests\Communication; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Class NotificationsTest. | ||
*/ | ||
class NotificationsTest extends TestCase | ||
{ | ||
public function testRetrievesNotificationsProperly() | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
public function testRetrievesNotificationsHtmlProperly() | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
public function testPushesSimpleNotification() | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
public function teestPushesExtendedNotification() | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
tests/ConfigurationParser/PluginConfigurationParserTest.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace LoxBerry\Tests\System\Utility; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Class AjaxNotificationHandlerTest. | ||
*/ | ||
class AjaxNotificationHandlerTest extends TestCase | ||
{ | ||
public function testGetsDataAsString() | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
public function testGetsDataAsArrayExpectingJson() | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
} |
Oops, something went wrong.