PHPCS fixes

This commit is contained in:
Gerhard Potgieter 2018-07-09 13:04:16 +02:00
parent 1fdcf2a238
commit bc3c780b92
1 changed files with 20 additions and 17 deletions

View File

@ -28,8 +28,8 @@ class WC_Tests_Log_Handler_File extends WC_Unit_Test_Case {
foreach ( $log_files as $file ) {
$file_path = WC_Log_Handler_File::get_log_file_path( $file );
if ( file_exists( $file_path ) && is_writable( $file_path ) ) {
unlink( $file_path );
if ( file_exists( $file_path ) && is_writable( $file_path ) ) { // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable
unlink( $file_path ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_unlink
}
}
parent::tearDown();
@ -47,7 +47,10 @@ class WC_Tests_Log_Handler_File extends WC_Unit_Test_Case {
public function test_legacy_format() {
$handler = new WC_Log_Handler_File( array( 'threshold' => 'debug' ) );
$handler->handle( time(), 'info', 'this is a message', array( 'source' => 'unit-tests', '_legacy' => true ) );
$handler->handle( time(), 'info', 'this is a message', array(
'source' => 'unit-tests',
'_legacy' => true,
) );
$this->assertStringMatchesFormat( '%d-%d-%d @ %d:%d:%d - %s', $this->read_content( 'unit-tests' ) );
$this->assertStringEndsWith( ' - this is a message' . PHP_EOL, $this->read_content( 'unit-tests' ) );
@ -172,7 +175,7 @@ class WC_Tests_Log_Handler_File extends WC_Unit_Test_Case {
// Write some files to ensure they've rotated correctly
for ( $i = 0; $i < 10; $i++ ) {
file_put_contents( WC_Log_Handler_File::get_log_file_path( $log_name . ".{$i}" ), $i );
file_put_contents( WC_Log_Handler_File::get_log_file_path( $log_name . ".{$i}" ), $i ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_file_put_contents
}
$context_source = array( 'source' => $log_name );