mabasic
4 years ago
1100
11
General

Call to a member function make() on null

Posted 4 years ago by mabasic

This is strange.

Same global composer dependencies on both PCs but running phpunit on one PC throws fatal error while running phpunit on another PC returns all tests green.

This is a fresh installation of L5. When working with L4 applications everything works on both PCs.

I will start from start. First the test:

<?php
class ExampleTest extends TestCase {
    /**
     * A basic functional test example.
     *
     * @return void
     */
    public function testBasicExample()
    {
        $response = $this->call('GET', '/');
        $this->assertEquals(200, $response->getStatusCode());
    }
}

Now my global composer dependencies:

{
    "require": {
        "laravel/installer": "~1.1",
        "laravel/envoy": "~1.0",
        "laravel/homestead": "~2.0",
        "phpunit/phpunit": "~4.0",
        "mabasic/kalista": "0.7.*",
        "codeception/codeception": "~2.0"
    }
}

The dependencies are the same on both PCs.

Now the error I get on one PC:

PHPUnit 4.5.0 by Sebastian Bergmann and contributors.

Configuration read from F:\Repositories\acme\phpunit.xml

PHP Fatal error:  Call to a member function make() on null in F:\Repositories\acme\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php on line 164

Now the things that I have tried:

I have tried

  • deleting local composer vendor folder and using composer update
  • deleting global composer vendor folder and using composer update
  • deleting composer cache and both local and global vendor folders and using composer update

The weird stuff:

  • When inside vm (homestead) if i run vendor/bin/phpunit everything works on both PCs. (so my reasoning is that there is nothing wrong with the L5 app, but something is most likely wrong in my global dependencies.)
  • Running phpunit on any L4 app works. It does not throw any kind of error. All tests run and pass.
  • I have tried running phpunit on two L5 apps, both fail with fatal error.

What can I do now?

Please sign in or create an account to participate in this conversation.