-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58f6df3
commit e4b0bcd
Showing
5 changed files
with
126 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
on: [push, pull_request] | ||
|
||
name: CI | ||
|
||
jobs: | ||
php-cs-fixer: | ||
name: PHP-CS-Fixer | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
extensions: apcu | ||
- name: PHP-CS-Fixer | ||
uses: OskarStark/[email protected] | ||
with: | ||
args: --diff --dry-run --allow-risky yes --stop-on-violation --using-cache=no --path-mode=intersection | ||
|
||
phpstan: | ||
name: PHPStan Static Analysis | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
extensions: apcu, smbclient | ||
- name: Composer | ||
run: composer install | ||
- env: | ||
BACKEND: smbclient | ||
run: php ./vendor/bin/phpstan analyse --level 1 src | ||
|
||
phpunit: | ||
runs-on: ubuntu-20.04 | ||
name: Unit tests | ||
|
||
services: | ||
samba: | ||
image: dperson/samba | ||
env: | ||
USER: "test;test" | ||
SHARE: "test;/tmp;yes;no;yes;all;none" | ||
ports: | ||
- 139:139 | ||
- 445:445 | ||
|
||
steps: | ||
- name: Install packages | ||
run: | | ||
sudo apt-get install smbclient | ||
- uses: actions/checkout@v2 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
extensions: apcu, smbclient | ||
- name: Composer | ||
run: composer install | ||
- name: Config | ||
run: | | ||
cat tests/config.json | ||
echo '{"host": "localhost","user": "test","password": "test","share": "test","root": ""}' > tests/config.json | ||
cat tests/config.json | ||
- name: PHPUnit Tests | ||
env: | ||
BACKEND: smbclient | ||
run: php ./vendor/bin/phpunit tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* @copyright Copyright (c) 2021 Robin Appelman <[email protected]> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
namespace Icewind\SMB; | ||
|
||
|
||
class ProtocolLevel { | ||
/** @var string */ | ||
private $level; | ||
|
||
private function __construct(string $level) { | ||
$this->level = $level; | ||
} | ||
|
||
public function getLevel(): string { | ||
return $this->level; | ||
} | ||
|
||
public static function NT1(): self { | ||
return new ProtocolLevel("NT1"); | ||
} | ||
|
||
public static function SMB2(): self { | ||
return new ProtocolLevel("SMB2"); | ||
} | ||
|
||
public static function SMB3(): self { | ||
return new ProtocolLevel("SMB3"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters