deprecated-packages / symplify

[DISCONTINUED] Check split packages in their own repositories :)
MIT License
621 stars 189 forks source link

Statie: Running tests fails & deletes everything #83

Closed Majkl578 closed 7 years ago

Majkl578 commented 7 years ago

Cloned Statie into /tmp/Statie, installed dependencies and ran PHPUnit. Boom, everything disappeared!

$ ll
total 144
drwxr-xr-x  2 majkl majkl     80 Feb 23 20:47 bin
-rw-r--r--  1 majkl majkl   1298 Feb 23 20:47 composer.json
-rw-r--r--  1 majkl majkl 127347 Feb 23 20:47 composer.lock
drwxr-xr-x  2 majkl majkl     60 Feb 23 20:47 docs
-rw-r--r--  1 majkl majkl   1075 Feb 23 20:47 LICENSE
-rw-r--r--  1 majkl majkl    419 Feb 23 20:47 phpunit.xml
-rw-r--r--  1 majkl majkl   3833 Feb 23 20:47 README.md
drwxr-xr-x 17 majkl majkl    340 Feb 23 20:47 src
drwxr-xr-x 12 majkl majkl    240 Feb 23 20:47 tests
drwxr-xr-x 28 majkl majkl    580 Feb 23 20:47 vendor

$ vendor/bin/phpunit 
PHPUnit 5.7.14 by Sebastian Bergmann and contributors.

.PHP Warning:  include(/tmp/Statie/vendor/composer/../phpunit/phpunit/src/Framework/TestFailure.php): failed to open stream: No such file or directory in /tmp/Statie/vendor/composer/ClassLoader.php on line 414

Warning: include(/tmp/Statie/vendor/composer/../phpunit/phpunit/src/Framework/TestFailure.php): failed to open stream: No such file or directory in /tmp/Statie/vendor/composer/ClassLoader.php on line 414
PHP Warning:  include(): Failed opening '/tmp/Statie/vendor/composer/../phpunit/phpunit/src/Framework/TestFailure.php' for inclusion (include_path='.:/usr/local/share/pear') in /tmp/Statie/vendor/composer/ClassLoader.php on line 414

Warning: include(): Failed opening '/tmp/Statie/vendor/composer/../phpunit/phpunit/src/Framework/TestFailure.php' for inclusion (include_path='.:/usr/local/share/pear') in /tmp/Statie/vendor/composer/ClassLoader.php on line 414
PHP Fatal error:  Uncaught Error: Class 'PHPUnit_Framework_TestFailure' not found in /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestResult.php:250
Stack trace:
#0 /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestResult.php(862): PHPUnit_Framework_TestResult->addError(Object(Symplify\Statie\Tests\Application\StatieApplicationTest), Object(PHPUnit_Framework_Error_Warning), 0.032729148864746)
#1 /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestCase.php(926): PHPUnit_Framework_TestResult->run(Object(Symplify\Statie\Tests\Application\StatieApplicationTest))
#2 /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestSuite.php(728): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#3 /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestSuite.php(728): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#4 /tmp/Statie/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(521): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#5 /tmp/Statie/vendor/phpunit/phpunit/src/T in /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestResult.php on line 250

Fatal error: Uncaught Error: Class 'PHPUnit_Framework_TestFailure' not found in /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestResult.php:250
Stack trace:
#0 /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestResult.php(862): PHPUnit_Framework_TestResult->addError(Object(Symplify\Statie\Tests\Application\StatieApplicationTest), Object(PHPUnit_Framework_Error_Warning), 0.032729148864746)
#1 /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestCase.php(926): PHPUnit_Framework_TestResult->run(Object(Symplify\Statie\Tests\Application\StatieApplicationTest))
#2 /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestSuite.php(728): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#3 /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestSuite.php(728): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#4 /tmp/Statie/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(521): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#5 /tmp/Statie/vendor/phpunit/phpunit/src/T in /tmp/Statie/vendor/phpunit/phpunit/src/Framework/TestResult.php on line 250

$ ll
total 0
TomasVotruba commented 7 years ago

Oh, you just cloned into its Container's temp dir :D Never occurred to me to use cache dir to real work.

https://github.com/Symplify/Symplify/blob/master/packages/Statie/src/DI/Container/ContainerFactory.php#L23

Suggestions?

Majkl578 commented 7 years ago

I realized. :) I usually clone temporary things into /tmp and Git uses the last component of the URL...

Suggestions?

Depends, is the cache meant to be persistent? If no, you can just generate random suffix and delete after work is done. Otherwise it's more complex issue (i.e. do you want multiple Staties use same cache dir?).

TomasVotruba commented 7 years ago

I usually clone temporary things into /tmp and Git uses the last component of the URL...

Good to know.

I think I have it more randomized in other packages. Not sure why here I used only obvious vendor name.

Anyway, it must have been amazing feeling, trying to tun test and have everything deleted :D

Majkl578 commented 7 years ago

Indeed. :trollface: