Jordi Boggiano
8cd2d0e541
Fix scanning of classmaps in files containing invalid Unicode, fixes #10102
2021-09-15 11:31:43 +02:00
jrfnl
b66b23a03f
ClassMapGeneratorTest: add test with consecutive duplicate heredoc markers
...
... as well as a test with heredoc markers with only a newline character between the start and end marker.
2021-08-21 17:45:42 +02:00
jrfnl
9588654ae3
ClassMapGenerator: add tests for "long heredoc" bug
...
... to proof the existence of the bug and demonstrate the effect.
Note: in the test the backtrack limit is being lowered (and restored back to the default afterwards) to prevent the tests needing ridiculously huge test fixture files.
2021-08-11 22:21:57 +02:00
Ayesh Karunaratne
228428747a
Add support for autoloading Enums
...
PHP 8.1 supports Enums, and [Enums follow class-semantics](https://php.watch/versions/8.1/enums#class-semantics-autoload ).
Composer's class-map generator currently looks for `class`, `interface`, and `trait` keywords. If Composer is run in PHP 8.1 or later, Composer now additionally looks for `enum` keyword as well. This is similar to how Hack's `enum` support is added.
This PR also adds tests for basic enums, backed enums, namespaced enums, and an enum that implements an interface and extends a class.
2021-02-06 15:51:18 +07:00
Jordi Boggiano
1593b67230
Fix warnings on higher phpunit versions
2020-09-11 11:01:32 +02:00
Ion Bazan
a2137d5263
use Symfony PHPUnit Bridge
2020-02-07 12:22:22 +08:00
Gabriel Caruso
2a13bb2649
Fixes from PHPStan ( #7687 )
...
* fix docblocks
* remove redundant conditional
* fix wrong variable name
* fix wrong namespaces
* add missing private members
* remove unused/redundant arguments
* move testcase class
* exclude TestCase.php
* Tweak RuleWatchGraph type hints
* Tweak doc comment
2018-11-12 15:23:32 +01:00
Jordi Boggiano
3b9d6769bf
Fix class names in comments being parsed in short_open_tags files, fixes #7289
2018-05-04 11:02:12 +02:00
Gabriel Caruso
885da4c8ef
Refactoring tests
2017-12-03 02:41:58 -02:00
Rob Bast
4213fbc8c6
does not apply for hhvm
2016-09-23 13:27:15 +02:00
Rob Bast
181b172e77
test cases for #5701
2016-09-23 12:22:45 +02:00
Jordi Boggiano
f0f932fca4
Fix classmap test on windows
2016-09-10 12:52:23 +02:00
Vyacheslav Pavlov
108560b9c4
Clean up temp files after a test.
2016-07-21 16:37:26 +03:00
Vyacheslav Pavlov
03995d6caa
Added test for 'dump' method of ClassMapGenerator class
2016-07-20 23:33:37 +03:00
Jordi Boggiano
f0d67923a5
Fix classmap generator over anonymous classes extending/implementing something, fixes #5239
2016-04-24 14:40:51 +01:00
Niels Keurentjes
0b55a0ca91
Can't use error_clear_last as it was introduced in PHP7.
2016-02-06 02:58:36 +01:00
Rob Bast
adf3b956d0
try to use unique test directories
...
any tests that use the filesystem should have their own unique directory, as we run our test suite in parallel and
cleanup of tests (removing directories) should not interfere with currently running tests
2016-01-26 09:41:21 +01:00
Rob Bast
b523fc0b7b
ran fixers
2015-10-13 11:35:51 +02:00
Jordi Boggiano
b2173d28fc
Fix 5.3.3 build
2015-06-16 11:43:55 +01:00
Jordi Boggiano
e73448ae1e
Add possessive quantifiers to avoid backtracking and fix segfault on large files, fixes #4153
2015-06-16 11:22:45 +01:00
Possum
29ca21f30e
PHP version checks tweaking
2015-05-05 20:18:24 +02:00
Fred Emmott
23d5e30fbc
Add test for Generics class
...
Already worked, just adding a test.
2015-03-09 11:29:04 -07:00
Fred Emmott
cb1ea889d6
Use HHVM_VERSION instead of HPHP_VERSION
2015-03-09 10:02:10 -07:00
Fred Emmott
33ea86573e
Add support for using classmap to autoload Hack enums
...
fixes composer/composer#3823
Ran tests with both PHP5.5.9-1ubuntu4.5 and HHVM 3.6. Test fails on HHVM only
if I back out the ClassMapGenerator.php change.
2015-03-09 09:38:02 -07:00
Rob Bast
cb336a5416
Implement writeError throughout Composer
2015-02-25 11:00:35 +01:00
Denis Sokolov
836534067b
Avoid ambiguity warning for example directories as well
...
In particular, PEAR repositories use a classmap and example directories trigger
multiple false positive warnings.
2014-04-10 21:03:35 +09:00
Denis Sokolov
65b9cca7b5
Fix ClassMapGenerator unambiguousReference test coverage
...
Without this fix the test only covers having files in "test", the "fixture"
portion it is not covered at all, because all fixtures in phpunit tests
are already in "test" directory
2014-04-10 21:03:26 +09:00
Jordi Boggiano
0902305196
Fix classmap generator warnings and tests
2014-04-01 14:38:31 +02:00
Jordi Boggiano
8974a1ac92
Ignore ambiguous classes in tests/fixtures dirs, fixes #2858
2014-03-31 21:36:48 +02:00
Daniel Karp
e3be04c443
Don't show Ambiguous class resolution warning if class when not ambiguous
...
if a class or interface is defined twice in the same class, this should not produce a warning
2014-03-30 12:53:15 -04:00
Jordi Boggiano
7daf876d70
Fix test because the order of filesystem iteration is non deterministic
2014-03-29 18:10:32 +01:00
Jordi Boggiano
781c97fa9b
Refactor to avoid global static state
2014-03-29 17:46:55 +01:00
Jan Brecka
b94838169d
show warning only instead of throwing exception
2014-03-24 14:34:02 +01:00
Jan Brecka
de09c5e371
remove duplicity
2014-03-24 10:35:44 +01:00
Jan Brecka
5763685e69
use statement
2014-03-24 10:30:50 +01:00
Jan Brecka
ea7717c8e5
improve exception message
2014-03-20 14:24:42 +01:00
Jan Brecka
13b57112a9
Throw RuntimeException when ambiguous reference was found.
2014-03-20 13:37:05 +01:00
David Simon
2665c60b2f
Test for bug parsing multiline strings with 'escaped' newlines
2013-05-21 16:29:11 -04:00
Jordi Boggiano
aefe3a0b11
Add support for .inc files in classmap, fixes #1396
2012-12-08 21:54:51 +01:00
Jordi Boggiano
de3235a2a4
Add tests to prevent regressions on strings/nowdoc/comment stripping
2012-11-25 14:10:58 +01:00
Jordi Boggiano
5a01ada383
Restrict unicode chars allowed to what php core allows, refs #1361
2012-11-25 14:07:06 +01:00
Jordi Boggiano
2d7c3c9d27
Tweak #1361 to re-enable support for unicode classnames
2012-11-25 13:52:42 +01:00
Igor Wiedler
530991217b
Support classmap generation for classes without space after class name
...
Class names with multi-byte characters are not supported.
Closes #1360 .
2012-11-25 12:08:50 +01:00
Jordi Boggiano
75da832cd3
Fix parsing of large files that go over the PCRE limits
2012-11-12 12:33:46 +01:00
Victor Berchet
86bb1be61f
[ClassMapGeneratot] Filter out non php code
...
Otherwise files like https://github.com/propelorm/Propel/blob/master/generator/lib/behavior/i18n/templates/queryUseI18nQuery.php
would fail ("class" keyword would not be filtered out by php_strip_whitespace())
2012-11-12 09:15:35 +01:00
Victor Berchet
ab48114531
[ClassMapGenerator] Improve error message when the path does not exist
...
i.e. the composer.json has a typo
2012-11-12 07:33:15 +01:00
Victor Berchet
ff5c428d60
[ClassMapGenerator] Refine the findClasses method
...
The code could not throw
2012-11-12 07:32:47 +01:00
Jordi Boggiano
5a763cf010
Fix scanning of empty namespace{} blocks
2012-11-11 16:29:49 +01:00
Martin Hasoň
81e8261692
Added tests for traits
2012-03-21 12:57:50 +01:00
Benjamin Eberlei
671cd5ee08
Add tests for ClassMapGenerator
2012-03-05 14:10:01 +01:00