JulienBreux / phpunit-docker

DEPRECATED :package: Docker image to use PHPUnit as CLI.
https://hub.docker.com/r/phpunit/phpunit/
MIT License
47 stars 28 forks source link

Doesn't work for code at php 7.1 #55

Closed ArtyomNorin closed 7 years ago

ArtyomNorin commented 7 years ago

After run test for code at php 7.1 i got error: ParseError: syntax error, unexpected '?' It doesn't understand nullable types. Container with tag 5.7.5.

Yeah i know that version 5.7.5 constructed on php 7.0.14, but phpunit 5.7.5 supports php 7.1.

JulienBreux commented 7 years ago

Hello @ArtyomNorin,

Could you describe me your process or show me the code (just the concern part)?

Thanks for using this Docker image :)

Have a nice day!

ArtyomNorin commented 7 years ago

Yeah sure :) I have class:

class UserBuilder
{
    private $email;

    public function withEmail(string $email) : self
    {
        //throw \InvalidArgumentException if variable $email is empty
    }

    public function getEmail() : ?string
    {
        return $this->email;
    }
}

And test for method withEmail

class UserBuilderTest extends \PHPUnit_Framework_TestCase
{
    public function testUserBuildWithEmptyEmail()
    {
        $user_builder = new UserBuilder();

        $this->expectException(\InvalidArgumentException::class);

        $user_builder->withEmail('');
    }
}

Run test phpunit src/AppBundle/Tests/Entity/Builder/UserBuilderTest.php

And got error:

PHPUnit 5.7.5 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 28 ms, Memory: 4.00MB

There was 1 error:

1) AppBundle\Tests\Entity\Builder\UserBuilderTest::testUserBuildWithEmptyEmail
ParseError: syntax error, unexpected '?'

/app/src/AppBundle/Entity/Builder/UserBuilder.php:95
/app/src/AppBundle/Tests/Entity/Builder/UserBuilderTest.php:12
/tmp/vendor/phpunit/phpunit/src/TextUI/Command.php:188
/tmp/vendor/phpunit/phpunit/src/TextUI/Command.php:118

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.

Line 95 is the definition of method getEmail

Content of phpunit shell:

#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
docker run -v $(pwd):/app --rm phpunit/phpunit $@
JulienBreux commented 7 years ago

Hmm sorry, actually, there is no package on PHP 7.1 in Alpine Linux.

We work hard on building this packages for Alpine Linux Edge.

A question of couple of weeks I know.

Please, wait. Sorry again :/

ArtyomNorin commented 7 years ago

Ok no problem :) In any case it is a useful image.

JulienBreux commented 7 years ago

@ArtyomNorin we work hard here: https://github.com/alpinelinux/aports/pull/716/

To build an amazing PHP7.1 image for Alpine Linux :)

JulienBreux commented 7 years ago

@ArtyomNorin I return to the news.

We've open a new PR here: https://github.com/alpinelinux/aports/pull/839

Question of time :)

To build an amazing PHP7.1 image for Alpine (Edge) Linux :)

svycka commented 7 years ago

@JulienBreux just a question why not https://hub.docker.com/_/php/ this is official php docker repository and has all versions alpine linux included

JulienBreux commented 7 years ago

@svycka yes, but the code [...]

svycka commented 7 years ago

@JulienBreux why you closed we still don't have 7.1 :D or I missed something? :D

JulienBreux commented 7 years ago

Hum, sorry, fu**** grey button :)

svycka commented 7 years ago

@JulienBreux I think it is already released no? can we have 7.1 support now?

westy92 commented 7 years ago

PHP 7.1 is now on the Alpine edge branch: https://pkgs.alpinelinux.org/package/edge/community/x86_64/php7

However, I'm proposing we switch to the latest stable branch: https://github.com/JulienBreux/phpunit-docker/issues/61