Skip to content

[Bug?]: Parse error #1

@JacquesDurand

Description

@JacquesDurand

Hi !
I recently stumbled upon Approval testing and am very glad some people made a library for it in php, thank you for that !

I am currently trying (for a class project) to upgrade a legacy application ( php 5.6, symfony 3.1) which contains a few controllers and wanted to setup approval tests before trying to upgrade/refacto the existing code base.

I ended up with the following error while trying to setup a simple test (your given example actually):

Parse error: syntax error, unexpected ':', expecting ';' or '{' in .../vendor/approvals/approval-tests/src/Namers/PHPUnitNamer.php on line 71

My Test Case is the following:

<?php

namespace Tests\Approvals\Controller;

use ApprovalTests\Approvals;
use PHPUnit\Framework\TestCase;

class DefaultControllerTest extends TestCase
{
    public function testList()
    {
        $list = ['zero', 'one', 'two', 'three', 'four', 'five'];
        Approvals::verifyList($list);
    }

//    public function testIndex()
//    {
//        $client = static::createClient();
//
//        $crawler = $client->request('GET', '/');
//
//        $response = (array) $client->getResponse();
//        Approvals::verifyAsJson($response);
//    }

}

And even the simple testList() returns the error mentioned earlier.
If it is any help, I am working through docker with a custom image of php-fpm-5.6-alpine, phpunit is at 5.7 version.

Thanks in advance and if you need any more details I would happily provide !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions