-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathHiddenDirectoryValidator.php
35 lines (27 loc) · 1.06 KB
/
HiddenDirectoryValidator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
declare ( strict_types = 1 );
namespace SatisPress\Test\Integration\Validator;
use SatisPress\Exception\InvalidPackageArtifact;
use SatisPress\Release;
use SatisPress\Test\Unit\TestCase;
use SatisPress\Validator\HiddenDirectoryValidator;
class HiddenDirectoryValidatorTest extends TestCase {
public function setUp(): void {
parent::setUp();
$this->directory = SATISPRESS_TESTS_DIR . '/Fixture/wp-content/uploads/satispress/packages/validate';
$this->release = $this->getMockBuilder( Release::class )
->disableOriginalConstructor()
->getMock();
$this->validator = new HiddenDirectoryValidator();
}
public function test_artifact_is_valid_zip() {
$filename = $this->directory . '/valid-zip.zip';
$result = $this->validator->validate( $filename, $this->release );
$this->assertTrue( $result );
}
public function test_validator_throws_exception_for_invalid_artifact() {
$this->expectException( InvalidPackageArtifact::class );
$filename = $this->directory . '/invalid-osx-zip.zip';
$this->validator->validate( $filename, $this->release );
}
}