C
C
cinet2018-03-28 00:10:26
Composer
cinet, 2018-03-28 00:10:26

Where to store login/password for integration unit tests in a project hosted on github?

I had to fork one PHP library on github and am finalizing it. The library uses composer and phpunit tests. There are integration tests with a third-party service (the service periodically changes the API, so these tests are really needed). In order for the tests to work, you must first register on a third-party service and enter a login / password in the tests.
Now the login/password is hardwired into the unit test file. Since the project is on github, this should be avoided.
You can move the login password to a separate file and include its contents. But, it seems to me, there should be a more beautiful solution - for example, as in Symfony: when executing composer install, a script is executed that checks parameters.yml.dist and creates parameters.yml. In symfony, a separate package is responsible for this.
I think I can pull it into the project and set it up, but then I still need to parse the yml file from the unit test, and this is another dependency. Total two "superfluous" dependencies.
Perhaps there is a best practice?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Papa, 2018-03-28
Stifflera @PapaStifflera

Environment variables won't work?

C
cinet, 2018-03-29
@cinet

I don't like the option with environment variables.
I chose the solution: require_once ('auth.php')
and the file itself is in gitignore and consists of two lines
$login=''
$pass = ''

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question