dbalabka / php-enumeration

Implementation of enumeration classes in PHP. The better alternative for enums
MIT License
53 stars 4 forks source link

Tests failing #3

Closed aheart closed 5 years ago

aheart commented 5 years ago

I've checked out the repository, ran composer install. Then to run the tests I've used php vendor/phpunit/phpunit/phpunit tests/EnumerationTest.php

$ php vendor/phpunit/phpunit/phpunit tests/EnumerationTest.php 
PHPUnit 8.3.4 by Sebastian Bergmann and contributors.

..E.EEEEEEFEEEEEE                                                 17 / 17 (100%)

Time: 34 ms, Memory: 6.00 MB

There were 13 errors:

1) Dbalabka\Tests\EnumerationTest::testInstantiateWithPublicConstructor
ParseError: syntax error, unexpected 'Action' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/ActionWithPublicConstructor.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:30

2) Dbalabka\Tests\EnumerationTest::testOrdinals
ParseError: syntax error, unexpected 'Action' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Action.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:41

3) Dbalabka\Tests\EnumerationTest::testAccessOrdinalsInConstructor
ParseError: syntax error, unexpected 'Flag' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Flag.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:48

4) Dbalabka\Tests\EnumerationTest::testName
ParseError: syntax error, unexpected 'Flag' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Flag.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:57

5) Dbalabka\Tests\EnumerationTest::testToString
ParseError: syntax error, unexpected 'Flag' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Flag.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:65

6) Dbalabka\Tests\EnumerationTest::testEquals
ParseError: syntax error, unexpected 'Flag' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Flag.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:73

7) Dbalabka\Tests\EnumerationTest::testSerialization
ParseError: syntax error, unexpected 'Flag' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Flag.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:82

8) Dbalabka\Tests\EnumerationTest::testClone
ParseError: syntax error, unexpected 'Flag' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Flag.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:96

9) Dbalabka\Tests\EnumerationTest::testValueOf
ParseError: syntax error, unexpected 'Flag' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Flag.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:104

10) Dbalabka\Tests\EnumerationTest::testValueOfNotExistingName
ParseError: syntax error, unexpected 'Flag' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Flag.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:112

11) Dbalabka\Tests\EnumerationTest::testValues
ParseError: syntax error, unexpected 'Flag' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Flag.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:120

12) Dbalabka\Tests\EnumerationTest::testSwitchSupport
ParseError: syntax error, unexpected 'Action' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Action.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:137

13) Dbalabka\Tests\EnumerationTest::testCompareTo
ParseError: syntax error, unexpected 'Flag' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)

/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Flag.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:153

--

There was 1 failure:

1) Dbalabka\Tests\EnumerationTest::testUnserialization
Failed asserting that exception of type "ParseError" matches expected exception "Dbalabka\EnumerationException". Message was: "syntax error, unexpected 'Flag' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST)" at
/home/alex/Documents/dev/github/php-enumeration/tests/Fixtures/Flag.php:10
/home/alex/Documents/dev/github/php-enumeration/tests/EnumerationTest.php:91
.

ERRORS!
Tests: 17, Assertions: 4, Errors: 13, Failures: 1.

PHP version:

$ php -v
PHP 7.2.19-0ubuntu0.18.04.2 (cli) (built: Aug 12 2019 19:34:28) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.19-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies
dbalabka commented 5 years ago

I have to setup Travis to run tests on all >= 7.1 PHP versions. I developt it using PHP 7.4 :)

dbalabka commented 5 years ago

Tests are fixed and pass for all supported PHP version (>= 7.1). Test coverage added as well.