Skip to content

Commit

Permalink
Add optional search.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Jan 10, 2019
1 parent 29baea1 commit 23d6d85
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 14 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"require": {
"php": ">=5.6",
"cakephp/cakephp": "^3.5"
"cakephp/cakephp": "^3.7"
},
"require-dev": {
"cakephp/migrations": "@stable",
Expand All @@ -54,7 +54,7 @@
"test-coverage": "php phpunit.phar --log-junit tmp/coverage/unitreport.xml --coverage-html tmp/coverage --coverage-clover tmp/coverage/coverage.xml",
"phpstan": "phpstan analyse -c tests/phpstan.neon -l 5 src/",
"phpstan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan && mv composer.backup composer.json",
"cs-check": "phpcs -p --standard=vendor/fig-r/psr2r-sniffer/PSR2R/ruleset.xml --ignore=/cakephp-databaselog/vendor/,/tmp/,/logs/,/config/Migrations/ --extensions=php ./",
"cs-fix": "phpcbf --standard=vendor/fig-r/psr2r-sniffer/PSR2R/ruleset.xml --ignore=/cakephp-databaselog/vendor/,/tmp/,/logs/,/config/Migrations/ --extensions=php ./"
"cs-check": "phpcs -p --standard=vendor/fig-r/psr2r-sniffer/PSR2R/ruleset.xml --ignore=/config/Migrations/ --extensions=php src/ tests/ config/",
"cs-fix": "phpcbf --standard=vendor/fig-r/psr2r-sniffer/PSR2R/ruleset.xml --ignore=/config/Migrations/ --extensions=php src/ tests/ config/"
}
}
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ini name="apc.enable_cli" value="1"/>
<!-- E_ALL & ~E_USER_DEPRECATED (16383)-->
<!-- E_ALL (32767) -->
<ini name="error_reporting" value="16383"/>
<ini name="error_reporting" value="32767"/>
</php>

<!-- Add any additional test suites you want to run here -->
Expand Down
10 changes: 10 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace DatabaseLog;

use Cake\Core\BasePlugin;

/**
* Plugin for DatabaseLog
*/
class Plugin extends BasePlugin {
}
5 changes: 4 additions & 1 deletion src/Template/Element/paging.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
* @link https://github.com/dereuromark/CakePHP-DatabaseLog
* @var \App\View\AppView $this
*/

use Cake\Core\Plugin;

?>

<?php
if (\Cake\Core\Plugin::loaded('Tools')) {
if (Plugin::isLoaded('Tools')) {
echo $this->element('Tools.pagination');
} else {
?>
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Controller/LogsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class LogsControllerTest extends IntegrationTestCase {
* @var array
*/
public $fixtures = [
'plugin.database_log.database_logs',
'core.sessions'
'plugin.DatabaseLog.DatabaseLogs',
'core.Sessions'
];

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Log/Engine/DatabaseLogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DatabaseLogTest extends TestCase {
* @var array
*/
public $fixtures = [
'plugin.database_log.database_logs'
'plugin.DatabaseLog.DatabaseLogs'
];

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/TestCase/Model/Table/DatabaseLogsTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DatabaseLogsTableTest extends TestCase {
* @var array
*/
public $fixtures = [
'plugin.database_log.database_logs'
'plugin.DatabaseLog.DatabaseLogs'
];

/**
Expand Down Expand Up @@ -86,23 +86,23 @@ public function testGetTypes() {
$this->Logs->deleteAll('1=1');

$data = [
'type' => 'Foo',
'type' => 'foo',
'message' => 'some text'
];
$log = $this->Logs->newEntity($data);
$res = $this->Logs->save($log);
$this->assertTrue(!empty($res));

$data = [
'type' => 'Bar',
'type' => 'bar',
'message' => 'some more text'
];
$log = $this->Logs->newEntity($data);
$res = $this->Logs->save($log);
$this->assertTrue(!empty($res));

$res = $this->Logs->getTypes();
$this->assertSame(['Bar', 'Foo'], $res);
$this->assertSame(['bar' => 'bar', 'foo' => 'foo'], $res);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Shell/DatabaseLogShellTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DatabaseLogShellTest extends TestCase {
* @var array
*/
public $fixtures = [
'plugin.database_log.database_logs'
'plugin.DatabaseLog.DatabaseLogs'
];

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

Cake\Cache\Cache::setConfig($cache);

Cake\Core\Plugin::load('DatabaseLog', ['path' => ROOT . DS, 'autoload' => true, 'bootstrap' => false, 'routes' => true]);
Cake\Core\Plugin::getCollection()->add(new \DatabaseLog\Plugin());

// Ensure default test connection is defined
if (!getenv('db_class')) {
Expand Down

0 comments on commit 23d6d85

Please sign in to comment.