Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Argentinian holidays provider. #264

Merged
merged 12 commits into from
Dec 23, 2021

Conversation

nedSaf
Copy link
Contributor

@nedSaf nedSaf commented Nov 17, 2021

No description provided.

@nedSaf nedSaf marked this pull request as draft November 17, 2021 12:55
@nedSaf
Copy link
Contributor Author

nedSaf commented Nov 18, 2021

Update

  • Added a new provider.
  • Configured all the holidays and set all the descriptions from Wikipedia.

ScreenShots

(This is a system we use for work logging, we pull the holidays into the work calendar)
2021-11-18 12 21 21
2021-11-18 12 22 12

Next

  • Add unit test for all the holidays in this provider. (Copying the tests from other providers)

TB

3h

Copy link

@mariano-dagostino mariano-dagostino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nedSaf Checked all the days. They look good. The timezone is incorrect. Santiago is located in Chile.

src/Yasumi/Provider/Argentina.php Outdated Show resolved Hide resolved
@stelgenhof
Copy link
Member

stelgenhof commented Nov 18, 2021

Thanks @nedSaf for your work! Nice to have a another country added. Please do not forget to add unit tests.

@nedSaf nedSaf changed the title [WIP] Create Argentinian holidays provider. Create Argentinian holidays provider. Nov 19, 2021
@nedSaf nedSaf marked this pull request as ready for review November 19, 2021 10:01
@nedSaf
Copy link
Contributor Author

nedSaf commented Nov 19, 2021

Update

  • Added proper naming of the holidays also in English.
  • Added tests for all the holidays.

ScreenShots

Unit test result

Screen Shot 2021-11-19 at 11 52 55

Holiday names in English

2021-11-19 11 59 27

Review

@stelgenhof This is ready for your review.

/cc @mariano-dagostino

@nedSaf
Copy link
Contributor Author

nedSaf commented Nov 19, 2021

Fixing tests...

Copy link

@mariano-dagostino mariano-dagostino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nedSaf looks good. There are two methods that could be renamed in the test.

tests/Argentina/RemembranceDayTest.php Outdated Show resolved Hide resolved
tests/Argentina/RemembranceDayTest.php Outdated Show resolved Hide resolved
Nader Safadi and others added 2 commits November 19, 2021 14:22
Co-authored-by: Mariano D'Agostino <mariano-dagostino@users.noreply.github.com>
Co-authored-by: Mariano D'Agostino <mariano-dagostino@users.noreply.github.com>
@stelgenhof
Copy link
Member

@nedSaf You may want to check your tests as some of them are failing.

@nedSaf
Copy link
Contributor Author

nedSaf commented Nov 22, 2021

@stelgenhof I fixed all the tests, ready for your review :)

@stelgenhof stelgenhof self-requested a review November 22, 2021 13:09
src/Yasumi/Provider/Argentina.php Outdated Show resolved Hide resolved
src/Yasumi/Provider/Argentina.php Outdated Show resolved Hide resolved
src/Yasumi/Provider/Argentina.php Show resolved Hide resolved
src/Yasumi/Provider/Argentina.php Outdated Show resolved Hide resolved
*/
public function testOfficialHolidays(): void
{
$this->assertDefinedHolidays([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This asserts that these holidays all are defined from the start test year (1980), which is correct. However it doesn't assert that the respective holidays are not present before their establishment year.

Copy link
Contributor Author

@nedSaf nedSaf Nov 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each test file has a method called testNotHoliday, which does exactly that (I know that they run for sure because they failed and I had to fix them), this structure of testing I copied from other providers so I think for consistency we should keep it as is.

But if you think otherwise, please let me know how you would like me to change the structure of the files?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just ran your test again and it fails:

1) Yasumi\tests\Argentina\ArgentinaTest::testObservedHolidays
Failed asserting that an array has the key 'carnavalMonday'.

You can replicate this by setting the starting test year lower than the establishment year. The error might not advertise itself as the actual test year is randomized.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stelgenhof I'm not sure what are you asking me to do here.

Each test has its own ESTABLISHMENT_YEAR on which the whole test is based, this is what I found in the other providers.

you can replicate this by setting the starting test year lower than the establishment year.

Yes, but it's set to a specific year on setUp, it will not fail unless you change the year.
The tests will fail if you change anything in the code, in this state, it will not fail.

Screen Shot 2021-11-24 at 9 13 22

Screen Shot 2021-11-24 at 9 13 39

In any case, please let me know exactly what you want me to do if you think I'm wrong, I'm not sure what I need to do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See for example this: https://github.com/azuyalabs/yasumi/blob/develop/tests/Georgia/GeorgiaTest.php#L65..L67

Your tests will not fail as your initial test start year (1980) is after any of the establishment years. It possibly can fail if you instantiate Yasumi with a year before any of the establishment years. Agreeably users might not do that a lot, but still is possible in case you'd like to see a backdated list of holidays.

tests/Argentina/ArgentinaTest.php Show resolved Hide resolved
@nedSaf
Copy link
Contributor Author

nedSaf commented Nov 23, 2021

@stelgenhof Fixed your comments, with one comment from me ^^

Copy link
Member

@stelgenhof stelgenhof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check my last comments.

@nedSaf
Copy link
Contributor Author

nedSaf commented Nov 29, 2021

Pushed a fix.

@stelgenhof
Copy link
Member

@nedSaf Did you have a chance to look at my last comment? Thanks!

@nedSaf
Copy link
Contributor Author

nedSaf commented Dec 14, 2021

@stelgenhof Hey, I did push a fix after your comment, 233f9d4

I think that will cover the case you mentioned before, if not, please let me know.

@nedSaf
Copy link
Contributor Author

nedSaf commented Dec 23, 2021

@stelgenhof any updates?

@stelgenhof stelgenhof added this to the v2.5.0 milestone Dec 23, 2021
@stelgenhof stelgenhof merged commit f612e46 into azuyalabs:develop Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants