我们未能确定您的请求PHPUNIT

时间:2015-10-28 17:00:19

标签: laravel-5 laravel-5.1

我有一个测试功能 -

class InstrumentTest extends TestCase {

    private $faker; 

    public function setUp() {
        $this->refreshApplication();
        $this->faker = Faker\Factory::create('en_EN');

        $user = App\User::find(2);

        $this->be($user);
    }

    /**
     * Test creating new instrument
     */
    public function testCreateNewInstrument() {
        $fakeName = $this->faker->name;

        $this->visit('/oem/instrument/create')
                ->type($fakeName, 'name')
                ->press('Create')
                ->seePageIs('/oem/instrument')
                ->see('Instrument Created Successfully!');

        # make sure that record is in the database
        $this->seeInDatabase('instrument', ['name' => $fakeName, 'company_id' => 1]);
    }
}

每次我运行“phpunit”我的测试模具,并在控制台中显示以下消息: “我们未能确定您的请求。”

我不确定如何解决这个问题,以及这是否与中间件有关?

1 个答案:

答案 0 :(得分:0)

解决方案TestCase.php的$ baseUrl值必须是您的域名