예제 #1
0
 /**
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $settings = \Phramework\SystemLog\APP\Bootstrap::getSettings();
     $this->phramework = \Phramework\SystemLog\APP\Bootstrap::prepare();
     $settings['system-log']->log = 'Phramework\\SystemLog\\Log\\DatabaseLog';
     $this->systemLog = new SystemLog($settings['system-log']);
 }
예제 #2
0
<?php

use Phramework\SystemLog\SystemLog;
include __DIR__ . '/../../vendor/autoload.php';
$settings = \Phramework\SystemLog\APP\Bootstrap::getSettings();
$phramework = \Phramework\SystemLog\APP\Bootstrap::prepare(true);
//$settings['system-log']->log = 'Phramework\\SystemLog\\Log\\TerminalLog';
//$settings['system-log']->log = 'Phramework\\SystemLog\\Log\\DatabaseLog';
$systemLog = new SystemLog($settings['system-log']);
$systemLog->register((object) ['runtime' => 'php server']);
$phramework->invoke();
예제 #3
0
 /**
  * @covers Phramework\SystemLog\SystemLog::prepareObject
  */
 public function testPrepareObject()
 {
     $this->setUp();
     $method = Phramework::METHOD_GET;
     //Force URI route
     $_SERVER['REQUEST_URI'] = '/dummy/1';
     $_SERVER['REQUEST_METHOD'] = $method;
     $additionalParameters = (object) ['API' => 'phpunit'];
     $this->systemLog->register($additionalParameters);
     //$that = $this
     $object = Bootstrap::invokeMethod($this->systemLog, 'prepareObject', [SystemLog::LOG_USER_ID | SystemLog::LOG_REQUEST_HEADERS | SystemLog::LOG_REQUEST_HEADER_ACCEPT | SystemLog::LOG_REQUEST_PARAMS | SystemLog::LOG_RESPONSE_BODY, (object) ['body_raw_limit' => 10], (object) [], $method, [], $additionalParameters]);
     $this->assertInternalType('object', $object);
     $this->assertObjectHasAttribute('request_id', $object);
     $this->assertObjectHasAttribute('URI', $object);
     $this->assertObjectHasAttribute('method', $object);
     $this->assertSame($method, $object->method);
 }