我无法回滚的PHPunit

时间:2019-04-04 18:06:33

标签: phpunit

我的交易有问题。我要在setup()处打开一个,到目前为止,我可以做到这一点,然后用TearDown()回滚。问题是我无法从($dbh)访问我的连接teardown()

class PanneauTest extends TestCase
{
    private $http;
    private $token;
    private $dbh;


    protected function setUp(): void
    {
        $this->http = new GuzzleHttp\Client(['base_uri' => 
    'http://localhost/rocourt/01-Backend/api/v1/public/']);

        $this->token = User::login('toto', '1234');

        $this->dbh = getConnection();
        $this->dbh->beginTransaction();
    }

    protected function tearDown(): void
    {
        //I can't use the dbh->rollback()from this function 
    }

0 个答案:

没有答案