Laravel 4 会话类在setUpBeforeClass中不可用

Laravel 4 会话类在setUpBeforeClass中不可用,laravel-4,Laravel 4,当我的第一个单元测试类运行时,为什么会话类在setUpBeforeClass中不可用?第一个单元测试类完成后,会话类在setUpBeforeClass中可用 我可以做些什么来确保会话在我的第一个单元测试中可用吗 <?php class AATest extends TestCase { public static function setUpBeforeClass() { parent::setUpBeforeClass(); \Sessi

当我的第一个单元测试类运行时,为什么会话类在setUpBeforeClass中不可用?第一个单元测试类完成后,会话类在setUpBeforeClass中可用

我可以做些什么来确保会话在我的第一个单元测试中可用吗

<?php
class AATest extends TestCase
{

    public static function setUpBeforeClass()
    {
        parent::setUpBeforeClass();
        \Session::put('tenantId',100);  // <-- this fails
        \Session::put('userId',1100);
    }

    public function setUp()
    {
        parent::setUp();
        \Session::put('tenantId',100);  // <-- if removed from before class, this works.
        \Session::put('userId',1100);
    }

    public function test1()
    {
        $tenantId = \Session::get('tenantId');
        $userId = \Session::get('userId');
        $this->assertEquals(100,$tenantId);
        $this->assertEquals(1100,$userId);
    }

}