Skip to content

Commit

Permalink
Add new methods to fix errors with DebugKit on Cake 3.7.
Browse files Browse the repository at this point in the history
Closes #70, #80.
  • Loading branch information
ADmad committed Dec 24, 2018
1 parent 7fbc7ba commit 427e58e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
48 changes: 48 additions & 0 deletions src/AbstractDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,24 @@ public function webservice($name, WebserviceInterface $webservice = null)
* Returns a logger instance
*
* @return \Psr\Log\LoggerInterface
*
* @deprecated 1.4.0 Use getLogger() instead.
*/
public function logger()
{
return $this->logger;
}

/**
* Returns a logger instance
*
* @return \Psr\Log\LoggerInterface
*/
public function getLogger()
{
return $this->logger;
}

/**
* Returns the connection name used in the configuration
*
Expand All @@ -134,6 +146,8 @@ public function configName()
* Use null to read current value.
*
* @return bool
*
* @deprecated 1.4.0 Use enableQueryLogging()/disableQueryLogging()/isQueryLoggingEnabled() instead.
*/
public function logQueries($enable = null)
{
Expand All @@ -144,6 +158,40 @@ public function logQueries($enable = null)
$this->_logQueries = $enable;
}

/**
* Enable/disable query logging
*
* @return $this
*/
public function enableQueryLogging()
{
$this->_logQueries = true;

return $this;
}

/**
* Disable query logging
*
* @return $this
*/
public function disableQueryLogging()
{
$this->_logQueries = false;

return $this;
}

/**
* Check if query logging is enabled.
*
* @return bool
*/
public function isQueryLoggingEnabled()
{
return $this->_logQueries;
}

/**
* Proxies the client's methods.
*
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Webservice/WebserviceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function testExecuteLoggingWithLoggerEnabled()
->expects($this->once())
->method('debug');

$this->webservice->driver()->logQueries(true);
$this->webservice->driver()->enableQueryLogging();
$this->webservice->driver()->setLogger($logger);

$query = new Query($this->webservice, new Endpoint());
Expand Down

0 comments on commit 427e58e

Please sign in to comment.