Skip to content

Commit 3789f3b

Browse files
committed
Merge pull request #19 from talyssonoc/fix_relative_path_issue
Finally fix relative path issue
2 parents da1be7b + b8f7ced commit 3789f3b

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ With `react-laravel` you'll be able to use [ReactJS](https://facebook.github.io/
99
You just need to add this to your `composer.json`'s `"require"`:
1010

1111
```json
12-
"talyssonoc/react-laravel": "0.5"
12+
"talyssonoc/react-laravel": "0.7"
1313
```
1414

1515
Also you got to set the `minimum-stability` of your `composer.json` to `dev`, adding this:

lib/React.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?php namespace React;
22

3+
// Fix PHPUnit issue with relative path for `autoload.php`
4+
if(!defined('ENVIRONMENT') || ENVIRONMENT != 'test') {
5+
require_once '../vendor/autoload.php';
6+
}
7+
38
class React {
49
private $react;
510
private $defaultOptions;

lib/ReactServiceProvider.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php namespace React;
22

3-
require '../vendor/autoload.php';
4-
53
use Illuminate\Support\ServiceProvider;
64
use Illuminate\Support\Facades\App;
75
use Illuminate\Support\Facades\Blade;
@@ -25,7 +23,7 @@ public function boot() {
2523
public function register() {
2624

2725
$this->app->bind('React', function() {
28-
26+
2927
$defaultReactPath = implode(DIRECTORY_SEPARATOR,
3028
[App::publicPath(), 'vendor', 'react-laravel', 'react.js']);
3129

@@ -37,7 +35,7 @@ public function register() {
3735

3836
$reactSource = file_get_contents($reactPath);
3937
$componentsSource = file_get_contents($componentsPath);
40-
38+
4139
return new React($reactSource, $componentsSource);
4240
});
4341
}

phpunit.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
ini_set('display_errors', '1');
55
ini_set('display_startup_errors', '1');
66

7-
// Requires the Composer's autoload
8-
require __DIR__ . '/vendor/autoload.php';
7+
define('ENVIRONMENT', 'test');
8+
9+
require_once 'vendor/autoload.php';
910

1011
$GLOBALS['reactSource'] = file_get_contents(__DIR__ . '/assets/react.js');
1112
$GLOBALS['componentsSource'] = file_get_contents(__DIR__ . '/tests/fixtures/components.js');

0 commit comments

Comments
 (0)