Skip to content

+ travis #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: php
before_script: composer install
php:
- '7.0'
- '7.1'
- nightly
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<phpunit bootstrap="vendor/autoload.php">
<phpunit bootstrap="tests/bootstrap.php">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
Expand Down
21 changes: 9 additions & 12 deletions src/Environment.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
<?php
/**
* Created by PhpStorm.
* User: bogdans
* Date: 17.4.3
* Time: 22:23
*/

namespace MessageQueue;


use Exception\FileCreateError;
use MessageQueue\Exception\FileCreateError;
use Symfony\Component\OptionsResolver\OptionsResolver;

class Environment
Expand Down Expand Up @@ -69,19 +62,23 @@ public function create()
{
$queueDir = $this->queueDir();
if (!@mkdir($queueDir, 0775, true) && !is_dir($queueDir)) {
throw new FileCreateError(error_get_last());
$error = error_get_last();
throw new FileCreateError( " {$error['message']}\n {$error['file']}:{$error['line']}", (int)$error['type']);
}
$readFile = $this->readFile();
if (!is_file($readFile) && !@touch($readFile)) {
throw new FileCreateError(error_get_last());
$error = error_get_last();
throw new FileCreateError( " {$error['message']}\n {$error['file']}:{$error['line']}", (int)$error['type']);
}
$readPointerFile = $this->rotateFile();
if (!is_file($readPointerFile) && !@touch($readPointerFile)) {
throw new FileCreateError(error_get_last());
$error = error_get_last();
throw new FileCreateError( " {$error['message']}\n {$error['file']}:{$error['line']}", (int)$error['type']);
}
$writeFile = $this->writeFile();
if (!is_file($writeFile) && !@touch($writeFile)) {
throw new FileCreateError(error_get_last());
$error = error_get_last();
throw new FileCreateError( " {$error['message']}\n {$error['file']}:{$error['line']}", (int)$error['type']);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/FileAccessError.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Exception;
namespace MessageQueue\Exception;


class FileAccessError extends \RuntimeException
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/FileCreateError.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Exception;
namespace MessageQueue\Exception;


class FileCreateError extends \RuntimeException
Expand Down
4 changes: 2 additions & 2 deletions tests/EnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testEnvironmentValidationSuccess()
}

/**
* @expectedException \ErrorException
* @expectedException \MessageQueue\Exception\FileCreateError
*/
public function testEnvironmentValidationCompleteFailure()
{
Expand All @@ -80,7 +80,7 @@ public function testEnvironmentValidationCompleteFailure()
}

/**
* @expectedException \ErrorException
* @expectedException \MessageQueue\Exception\FileCreateError
*/
public function testEnvironmentValidationPartialFailure()
{
Expand Down
11 changes: 11 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
/**
* Created by PhpStorm.
* User: rsvecs
* Date: 21/07/2017
* Time: 23:12
*/

require_once __DIR__.'/../vendor/autoload.php';

putenv('PHP_MSTACK_VAR_DIR='.sys_get_temp_dir());