This project is archived. Its data is read-only.

Goal: make it possible to test Laravel projects

siegegg and many other PHP projects are based on Laravel. By making Laravel projects testable using PSpec, it鈥檒l be much easier to get going and a lot more attractive to developers.

The main challenge is that Laravel testing revolves around PHPUnit. The Illuminate\Foundation\Testing\TestCase that is used by default in the generated tests/TestCase.php. Using the following script in a clean Laravel 9 installation, I get a test pass.

<?php

namespace Tests;

class Bridge extends TestCase
{
  public function __construct()
  {
  }
  public function runSetUp()
  {
    $this->setUp();
  }
}

describe('home', function () {
  subject(function () {
    $laravel = new Bridge();
    $laravel->runSetUp();

    return $laravel;
  });

  it('renders hello', function () {
    expect($this->subject->get('/')->__toString())->toContain('Laravel has wonderful, thorough documentation');
  });
});
Edited Mar 29, 2022 by Kev
Assignee Loading
Time tracking Loading