mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
Use PSR4 to autoload tests
This commit is contained in:
parent
e74a83a400
commit
3697e04c63
5 changed files with 14 additions and 11 deletions
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace SMB\Test;
|
||||
|
||||
require_once 'share.php';
|
||||
|
||||
class NativeShare extends Share {
|
||||
|
||||
/**
|
||||
* @var \Icewind\SMB\NativeShare $share
|
||||
*/
|
||||
protected $share;
|
||||
|
||||
public function setUp() {
|
||||
if (!function_exists('smbclient_state_new')) {
|
||||
$this->markTestSkipped('libsmbclient php extension not installed');
|
||||
}
|
||||
$this->config = json_decode(file_get_contents(__DIR__ . '/config.json'));
|
||||
$this->server = new \Icewind\SMB\NativeServer($this->config->host, $this->config->user, $this->config->password);
|
||||
$this->share = new \Icewind\SMB\NativeShare($this->server, $this->config->share);
|
||||
if ($this->config->root) {
|
||||
$this->root = '/' . $this->config->root . '/' . uniqid();
|
||||
} else {
|
||||
$this->root = '/' . uniqid();
|
||||
}
|
||||
$this->share->mkdir($this->root);
|
||||
}
|
||||
|
||||
public function testRestoreErrorHandler() {
|
||||
$handlerCalled = false;
|
||||
set_error_handler(function () use (&$handlerCalled) {
|
||||
$handlerCalled = true;
|
||||
});
|
||||
|
||||
$this->share->dir($this->root);
|
||||
|
||||
trigger_error('dummy');
|
||||
$this->assertTrue($handlerCalled);
|
||||
restore_error_handler();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue