Closed whikloj closed 5 years ago
@whikloj great idea, I will add that.
@mjordan I have a simple travis setup in my branch for #35 to ensure it works. Currently its failing on code sniffer. So I might have some of those fixes too. https://travis-ci.org/whikloj/riprap
I can't seem to run your tests, is there something I might need to do first?
What is the output from ./bin/phpunit
?
[/sw/var/www/DAM2/riprap]
> ./bin/phpunit
zsh: no such file or directory: ./bin/phpunit
Should phpunit be a dev requirement of the riprap?
Instead I was running it using my installed phpunit, which could be the problem.
> phpunit -v
PHPUnit 7.4.0 by Sebastian Bergmann and contributors.
Runtime: PHP 7.1.26
Configuration: /sw/var/www/DAM2/riprap/phpunit.xml
Testing Project Test Suite
EEsh: /usr/bin/sha1sum: No such file or directory
E.... 7 / 7 (100%)
Time: 241 ms, Memory: 18.00MB
There were 3 errors:
1) App\Tests\Command\CheckFixityCommandTest::testExecute
Symfony\Component\Yaml\Exception\ParseException: File "resources/sample_csv_config.yml" does not exist.
/sw/var/www/DAM2/riprap/src/Command/CheckFixityCommand.php:47
/sw/var/www/DAM2/riprap/vendor/symfony/console/Command/Command.php:255
/sw/var/www/DAM2/riprap/vendor/symfony/console/Tester/CommandTester.php:76
/sw/var/www/DAM2/riprap/tests/Command/CheckFixityCommandTest.php:26
2) App\Tests\Controller\FixityControllerTest::testGetResponseCode
Doctrine\DBAL\Exception\ConnectionException: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php:73
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:169
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:155
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php:48
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:356
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:420
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:380
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:324
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:789
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:619
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:162
/sw/var/www/DAM2/riprap/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:305
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
/sw/var/www/DAM2/riprap/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:183
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:283
/sw/var/www/DAM2/riprap/vendor/doctrine/doctrine-bundle/Repository/ContainerRepositoryFactory.php:45
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:713
/sw/var/www/DAM2/riprap/src/Plugin/PluginPersistToDatabase.php:61
/sw/var/www/DAM2/riprap/src/Controller/FixityController.php:43
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/HttpKernel.php:150
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/HttpKernel.php:67
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/Kernel.php:198
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/Client.php:68
/sw/var/www/DAM2/riprap/vendor/symfony/framework-bundle/Client.php:131
/sw/var/www/DAM2/riprap/vendor/symfony/browser-kit/Client.php:405
/sw/var/www/DAM2/riprap/tests/Controller/FixityControllerTest.php:12
Caused by
Doctrine\DBAL\Driver\PDOException: SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php:27
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:356
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:420
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:380
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:324
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:789
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:619
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:162
/sw/var/www/DAM2/riprap/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:305
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
/sw/var/www/DAM2/riprap/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:183
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:283
/sw/var/www/DAM2/riprap/vendor/doctrine/doctrine-bundle/Repository/ContainerRepositoryFactory.php:45
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:713
/sw/var/www/DAM2/riprap/src/Plugin/PluginPersistToDatabase.php:61
/sw/var/www/DAM2/riprap/src/Controller/FixityController.php:43
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/HttpKernel.php:150
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/HttpKernel.php:67
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/Kernel.php:198
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/Client.php:68
/sw/var/www/DAM2/riprap/vendor/symfony/framework-bundle/Client.php:131
/sw/var/www/DAM2/riprap/vendor/symfony/browser-kit/Client.php:405
/sw/var/www/DAM2/riprap/tests/Controller/FixityControllerTest.php:12
Caused by
PDOException: SQLSTATE[08006] [7] could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php:27
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:356
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:420
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:380
/sw/var/www/DAM2/riprap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:324
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:789
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:619
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:162
/sw/var/www/DAM2/riprap/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:305
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:78
/sw/var/www/DAM2/riprap/vendor/doctrine/persistence/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:183
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:283
/sw/var/www/DAM2/riprap/vendor/doctrine/doctrine-bundle/Repository/ContainerRepositoryFactory.php:45
/sw/var/www/DAM2/riprap/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:713
/sw/var/www/DAM2/riprap/src/Plugin/PluginPersistToDatabase.php:61
/sw/var/www/DAM2/riprap/src/Controller/FixityController.php:43
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/HttpKernel.php:150
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/HttpKernel.php:67
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/Kernel.php:198
/sw/var/www/DAM2/riprap/vendor/symfony/http-kernel/Client.php:68
/sw/var/www/DAM2/riprap/vendor/symfony/framework-bundle/Client.php:131
/sw/var/www/DAM2/riprap/vendor/symfony/browser-kit/Client.php:405
/sw/var/www/DAM2/riprap/tests/Controller/FixityControllerTest.php:12
3) App\Plugin\PluginFetchDigestFromShellTest::testPluginFetchDigestFromShell
Error: Call to a member function warning() on null
/sw/var/www/DAM2/riprap/src/Plugin/PluginFetchDigestFromShell.php:58
/sw/var/www/DAM2/riprap/tests/Plugin/PluginFetchDigestFromShellTest.php:22
ERRORS!
Tests: 7, Assertions: 7, Errors: 3.
Remaining deprecation notices (2)
1x: The "Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand" class is deprecated since Symfony 4.2, use "Symfony\Component\Console\Command\Command" with dependency injection instead.
1x in CheckFixityCommandTest::testExecute from App\Tests\Command
1x: The "App\Command\CheckFixityCommand" class extends "Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand" that is deprecated since Symfony 4.2, use {@see Command} instead.
1x in CheckFixityCommandTest::testExecute from App\Tests\Command
Okay I did some reading and now I see I should be running
./vendor/bin/simple-phpunit
which installs phpunit and seems to result in the same errors as above.
Resolved with e18262069a7d2bf1d6d2b7bc5969e89354cbb928. Thanks @whikloj.
Guessing it would be good to make sure this builds in multiple PHP versions. A simple travis matrix would allow it to check that it installs and that your tests pass.