Skip to content

Commit

Permalink
Fix Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Feb 2, 2020
1 parent 821ef22 commit 6b21367
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dist: trusty
php:
- "7.2"
- "7.3"
- "7.4"
- "master"
- "nightly"
matrix:
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"phpunit/phpunit": "^8",
"vimeo/psalm": "^3"
},
"scripts": {
"test": "phpunit && psalm"
},
"support": {
"docs": "https://github.com/paragonie/halite/tree/master/doc"
},
Expand Down
2 changes: 2 additions & 0 deletions src/Halite.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ final private function __construct()
* @param bool $decode
* @return callable|null
* @throws InvalidType
* @psalm-suppress InvalidReturnStatement
* @psalm-suppress InvalidReturnType
*/
public static function chooseEncoder($chosen, bool $decode = false)
{
Expand Down
14 changes: 9 additions & 5 deletions test/unit/StreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class StreamTest extends TestCase
*/
public function testFileHash()
{
$filename = tempnam('/tmp', 'x');
$filename = @tempnam('/tmp', 'x');

$buf = random_bytes(65537);
file_put_contents($filename, $buf);
Expand All @@ -46,13 +46,17 @@ public function testFileHash()
*/
public function testUnreadableFile()
{
$filename = tempnam('/tmp', 'x');
$filename = @tempnam('/tmp', 'x');
$buf = random_bytes(65537);
file_put_contents($filename, $buf);
chmod($filename, 0000);

try {
new ReadOnlyFile($filename);
if (DIRECTORY_SEPARATOR === '\\') {
$this->markTestSkipped('Windows permissions are weird.');
return;
}
$this->fail('File should not be readable');
} catch (CryptoException\FileAccessDenied $ex) {
$this->assertSame('Could not open file for reading', $ex->getMessage());
Expand Down Expand Up @@ -90,7 +94,7 @@ public function testUnreadableFile()
*/
public function testResource()
{
$filename = tempnam('/tmp', 'x');
$filename = @tempnam('/tmp', 'x');
$buf = random_bytes(65537);
file_put_contents($filename, $buf);

Expand Down Expand Up @@ -142,7 +146,7 @@ public function testResource()
*/
public function testFileRead()
{
$filename = tempnam('/tmp', 'x');
$filename = @tempnam('/tmp', 'x');

$buf = random_bytes(65537);
file_put_contents($filename, $buf);
Expand Down Expand Up @@ -189,7 +193,7 @@ public function testFileRead()

foreach ([255, 65537] as $size) {
$buffer = random_bytes($size);
$fileWrite = tempnam('/tmp', 'x');
$fileWrite = @tempnam('/tmp', 'x');
$mStream = new MutableFile($fileWrite);
$mStream->writeBytes($buffer);
$mStream->reset(0);
Expand Down

0 comments on commit 6b21367

Please sign in to comment.