mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 08:45:40 +08:00
Refactor all (except command) modules using new exceptions
This commit is contained in:
@@ -6,8 +6,7 @@ namespace SPC\Tests\globals;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LogLevel;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\exception\ExecutionException;
|
||||
use ZM\Logger\ConsoleLogger;
|
||||
|
||||
/**
|
||||
@@ -64,7 +63,7 @@ class GlobalFunctionsTest extends TestCase
|
||||
$this->markTestSkipped('Windows not support f_passthru');
|
||||
}
|
||||
$this->assertEquals(null, f_passthru('echo ""'));
|
||||
$this->expectException('SPC\exception\RuntimeException');
|
||||
$this->expectException(ExecutionException::class);
|
||||
f_passthru('false');
|
||||
}
|
||||
|
||||
@@ -80,16 +79,16 @@ class GlobalFunctionsTest extends TestCase
|
||||
$this->markTestSkipped('Windows not support shell');
|
||||
}
|
||||
$shell = shell();
|
||||
$this->assertInstanceOf('SPC\util\UnixShell', $shell);
|
||||
$this->assertInstanceOf('SPC\util\UnixShell', $shell->cd('/'));
|
||||
$this->assertInstanceOf('SPC\util\UnixShell', $shell->exec('echo ""'));
|
||||
$this->assertInstanceOf('SPC\util\UnixShell', $shell->setEnv(['SPC_TEST_ENV' => '1']));
|
||||
$this->assertInstanceOf('SPC\util\shell\UnixShell', $shell);
|
||||
$this->assertInstanceOf('SPC\util\shell\UnixShell', $shell->cd('/'));
|
||||
$this->assertInstanceOf('SPC\util\shell\UnixShell', $shell->exec('echo ""'));
|
||||
$this->assertInstanceOf('SPC\util\shell\UnixShell', $shell->setEnv(['SPC_TEST_ENV' => '1']));
|
||||
|
||||
[$code, $out] = $shell->execWithResult('echo "_"');
|
||||
$this->assertEquals(0, $code);
|
||||
$this->assertEquals('_', implode('', $out));
|
||||
|
||||
$this->expectException('SPC\exception\RuntimeException');
|
||||
$this->expectException('SPC\exception\ExecutionException');
|
||||
$shell->exec('false');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user