algolia / scout-extended

Scout Extended: The Full Power of Algolia in Laravel
https://www.algolia.com/doc/framework-integration/laravel/getting-started/introduction-to-scout-extended/
MIT License
397 stars 84 forks source link

[Question] Steps to contribute #245

Closed lscortesc closed 3 years ago

lscortesc commented 4 years ago

How can configure my local setup to contribute to project?

I want to contribute to project but I'm have some issues to configure my local setup. Does exist any guide to configure the project? I'm using php: ^7.4

My steps

Edit

I was able to solve the problem with phpstan by replacing $this->app->path() with $this->app->basePath() in the line https://github.com/algolia/scout-extended/blob/master/src/Helpers/SearchableFinder.php#L97 but I'm not sure if that it's correct.

When I run composer phpunit:test I have the follow error in multiple tests: Algolia\AlgoliaSearch\Exceptions\UnreachableException: Impossible to connect, please check your Algolia Application Id.

I don't know if I should configure an Algolia App for testing because exists a Mock of AlgoliaClient in https://github.com/algolia/scout-extended/blob/master/tests/TestCase.php#L124

If I should configure my credentials of Algolia, where should I put them?

Thanks

DevinCodes commented 3 years ago

Hey there, thank you for wanting to participate in the development of Scout Extended, and sorry for the late reply.

To run all the tests, you need to pass Algolia credentials indeed. During the test suite, we set up a basic Laravel application, and it uses the default Scout config. This means you need to make sure the ALGOLIA_APP_ID and ALGOLIA_SECRET variables are available in your environment. You can do this, for example, by running your tests like this:

ALGOLIA_APP_ID="yourAppID" ALGOLIA_SECRET="yourAdminAPIKey" composer test

Please note that the tests add records and perform operations on your application. Therefore, it's best to create a separate application with the free plan, to ensure the test suite doesn't alter your production data if there are naming collisions, and you don't go over your own plan's limits.

I'll add this info to the contributing guidelines soon.