1

I've been writing tests in lumen but I need to move to a different machine so I've been trying to set it all up. I copied over my tests but I get this error on all of them when I run them

 [Symfony\Component\Debug\Exception\FatalErrorException]
 Trait 'Laravel\Lumen\Testing\DatabaseTransactions' not found

I think I have lumen installed as I did the command composer require "laravel/installer". Is there something I'm meant to do?

Edit: I looked at the version that was working on my old machine and this code was at the top of app.php in the bootstrap folder

try {
(new Dotenv\Dotenv(__DIR__.'/../'))->load();
} catch (Dotenv\Exception\InvalidPathException $e) {
//
}

I inserted that at the top of app.php on my new machine and that error stopped appearing and I was now able to run a test. Unfortunately a new error occurs when I just have the default example test

1) ExampleTest::testBasicExample
   Error: Call to undefined method ExampleTest::visit()

I'm guessing that I'm still missing something from lumen/laravel

Niall
  • 518
  • 1
  • 6
  • 23

2 Answers2

1

That command is for the Laravel installer. The command for the Lumen installer is:

composer require "laravel/lumen-installer"

However, even then, that only installs the installer. You still need to run the command to create a new install (e.g. lumen new my-site).

There's a lot of ambiguity as to what you're trying to do and what you've attempted.

Generally when installing your site on a new machine, you should just need to clone your repository (or copy your code over), and do a composer install.

patricus
  • 59,488
  • 15
  • 143
  • 145
  • Sorry about the ambiguity I was attempting to clone it over. – Niall Mar 16 '16 at 10:27
  • If clone I it over and just do composer install I get an error that composer could not find a composer.json file, because the vendor folder and the other files do not seem to generate until I do something like composer require "laravel/lumen-installer" – Niall Mar 16 '16 at 10:35
  • 1
    @Niall You should add your `composer.lock` file to your repository. If you were building a library, you may want to ignore it, but since this is the repo for your application, you want to have it so you can clone your code anywhere, do a `composer install`, and know that the exact same versions of your dependencies will get pulled down. – patricus Mar 16 '16 at 14:05
0

Try the following:

composer cache clean
composer update
composer dump-autoload