I contributed to OSS for the first time
Published: 2024-02-24 10:54:14

# Introduction
I am in my third year of engineering, and ever since I became an engineer as a new graduate, I had a goal to contribute to OSS someday.

Finally, I was able to contribute to the repositories and functions that I usually use, so I would like to summarize the background of my contribution.

# Contents of Contribute
The merged PR is as follows

https://github.com/composer/composer/pull/11816

The repository is [Composer](https://getcomposer.org/).
It is a package management tool, familiar to anyone who uses PHP.

It is almost always used in modern PHP development.
I also use PHP and Laravel in my work, and I use Composer every day as a matter of course.

The content of the contribution is to add test code.
There is a command called "self-update" that allows version control of Composer itself, and I created a test case for that command from scratch.

The coverage was about 40%.
I tried to increase the coverage a little more, but with my ability, it would have taken a lot of time to do more, so I decided to call it a day and submitted a PR.

# How I found a contrib opportunity.
I found it on a website called [Good First Issue](https://goodfirstissue.dev/).

It is a site that summarizes recent issues labeled ``good first issue``, which means for beginners in OSS activities, by language.

I first came across this site about two months ago, and I have been visiting it every few days since then. One day I found this Issue posted on the site.

https://github.com/composer/composer/issues/10796

This issue said that "We don't have enough coverage of command test code at all, so please write more and more test code!"

I thought I could do it if I add test codes.
I had been investigating PHPUnit for the introduction of test codes at work, so I also wanted to try to output some test codes.

I learned that there is no test code yet for the self-update command, which I use frequently in my daily work, so I decided to write a test for this command. I thought it would be easy to write tests for this command since I use it regularly and know how it behaves.

# Background to the merge

I wrote the test code after work, and it took about 3 days.
I was really nervous when I submitted the PR.

After about two weeks, I received two suggestions.
The first was that I should use PHPUnit's [data provider](https://docs.phpunit.de/en/11.0/writing-tests-for-phpunit.html#data-providers). You are right. You are right....

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/711yrbafk2ghtscsi366.png)

The second point you made was that I should have made sure to write the canned text that I write in every file. I missed it. My apologies.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pg8zbxnjrotjmkekb53v.png)

After I made the correction, they merged the files. it took about a month from the time I submitted the PR to the time of the merge, including the waiting time.

# Conclusion
I am honestly happy to have achieved one of my goals as an engineer.
It makes me a little bit proud to think that my code, even if it's just a little bit, is now available to PHP developers all over the world as a part of Composer.

Also, Composer recently underwent a [major vulnerability patching](https://github.com/composer/composer/security/advisories/GHSA-7c6p-848j-wh5h).
When upgrading Composer, the self-update command is one of the most commonly used commands in the world. I am glad that I was able to make even a small contribution to improving the stability of the operation of the command.

I highly recommend the [Good First Issue](https://goodfirstissue.dev/) site to anyone interested in OSS activities.
I will continue to check it regularly to see if there are any Issues that I can respond to.