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

CI, better tests, bugfixes and cleaning #103

Merged
merged 9 commits into from
Nov 27, 2020

Conversation

yurii-github
Copy link
Contributor

@yurii-github yurii-github commented Oct 25, 2020

some current ideas I have to improve.

  • namespaces
  • phpunit version
  • some builds for different PHP versions

I wonder what do you think about it. If you don't mind I can keep this PR open like work in progress.

@topclaudy
Copy link
Owner

Why do you close this?

@yurii-github yurii-github reopened this Oct 25, 2020
@yurii-github
Copy link
Contributor Author

yurii-github commented Oct 25, 2020

I just wanted a feedback, if it is ok I can keep PR open. I have some ideas to make tests better and drop some dependencies, because in my view this package can live without them.

@yurii-github
Copy link
Contributor Author

by the way, builds for Laravel 5.6 are failing in master due to illuminate/database requirement (as I understand)
regards

@topclaudy
Copy link
Owner

by the way, builds for Laravel 5.6 are failing in master due to illuminate/database requirement (as I understand)
regards

I just wanted a feedback, if it is ok I can keep PR open. I have some ideas to make tests better and drop some dependencies, because in my view this package can live without them.

Every contribution for improvements is accepted

@topclaudy
Copy link
Owner

I just wanted a feedback, if it is ok I can keep PR open. I have some ideas to make tests better and drop some dependencies, because in my view this package can live without them.

Which dependencies do you want to drop?

@topclaudy
Copy link
Owner

by the way, builds for Laravel 5.6 are failing in master due to illuminate/database requirement (as I understand)
regards

We can bump the minimum Laravel version (-> 5.7)

@yurii-github
Copy link
Contributor Author

yurii-github commented Oct 26, 2020

as sum up of my audit of the code

  • lluminate database until version 5.6 is broken with your code and cannot be fixed due to laravel refactoring. In fact, from 5.6 till 5.8 we have similar iissue but we can work with workaround.
  • disassociate() and some other methods are not implemented thus keep potential issues.
  • as 5.5 cannot be not supported we can up PHP requirements to 7.1.

what i have done

  • i have dropped support of old versions and upped to 5.6 , and PHP to 7.1
  • i have moved tests in namespace
  • i have added support for several phpunit versions
  • i have added travis ci as backbone for ci
  • i have added semi-full support matrix for illuminate database
  • i have removed dependency on phpunit as it is not recommended
  • i have dropped all other non required dependencies

latest build https://travis-ci.org/github/yurii-github/compoships/builds/738894383

i wonder what you say. only after we agree or disagree on further move/plans I continue with morph support.

see you

p.s. about dropping support up to 5.7 - for me it is vital to keep 5.6 support as I personally depend on it in one way or another.
p.p.s. i will do rebase tomorrow

$this->child->setAttribute($foreignKey, $value);
}
// BC break in 5.8 : https://github.com/illuminate/database/commit/87b9833019f48b88d98a6afc46f38ce37f08237d
$relationName = property_exists($this, 'relationName') ? $this->relationName : $this->relation;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe throw error if 'relation' does not exist too

@topclaudy
Copy link
Owner

Sorry for the delay. I'm very busy on weekdays. Thanks for the improvements. I'll check them during the weekend and give feedback

@yurii-github
Copy link
Contributor Author

yurii-github commented Oct 28, 2020

hello
sure, no problems. I have almost finished with testing setup. I have added codeclimate as code coverage, so you just need to setup your own keys on travis ci for CC_TEST_REPORTER_ID

image



I will add some more tests to cover my cases, and that's probably it.
p.s. I would also recommend to remove Model class as trait usage is sufficient.

https://travis-ci.com/github/yurii-github/compoships/builds/195171843

- added Travis CI support
- added Codeclimate support
- better PHPUnit config
- made tests as namespaced
- fix composer.json with proper dependencies
- drop support for service provider hook as it is bloatware
- added support for several PHPUnit versions
@yurii-github
Copy link
Contributor Author

I think I did around 90% of what I wanted initially. Along this journey I have found several issues too.
anyway, test coverage looks like this by now.
image

p.s. i will squash commits tomorrow

@topclaudy
Copy link
Owner

Wow!! That's a lot of contributions. Thanks!

@topclaudy
Copy link
Owner

Can you please update the README for the steps required to run the tests?

@yurii-github
Copy link
Contributor Author

good day
sure, but give me a week or so, I have some very high work load this week, maybe I delay it till this weekend.

@yurii-github yurii-github changed the title WIP: better tests WIP: CI, better tests, bugfixes and cleaning Nov 15, 2020
@yurii-github
Copy link
Contributor Author

yurii-github commented Nov 15, 2020

I have finished with my changes.
I will be glad to hear your feedback on code review etc.
If you find it is too big, we can split it in small PRs and I can do it that way, or whatever you think is good.

I have unresolved only 1 thing - I don't know how to forbid user to install illuminate/database 5.6 with PHP 7.3+, because it is laravel issue. maybe some note in readme is enough, I don't know

Also, there is place for improvement like test coverage, because this project is still very risky in sense of changes and tweaks it provides.

regards


FINAL CHANGELOG

Changes

  • dropped requirement for PHP version, it is enforced by illuminate/database package
  • upped support for illuminate/database to 5.6+ (it requires PHP 7.1+ https://packagist.org/packages/illuminate/database#5.6.x-dev)
  • dropped hard dependencies on framework and other useless packages
  • removed Model class as it is not needed
  • removed ComposhipsServiceProvider as it is not needed
  • developer now requires to obtain PHPUnit phar manually

Fixes

  • fixed several bugs for illuminate/database 5.6
  • fixed several bugs for illuminate/database 5.8

Tests

  • added namespaces to tests so they can be resolved with autoload
  • added support for different PHP versions (7.1+)
  • added TravisCI support
  • added Codeclimate support
  • added more tests to cover more edge cases
  • other minor fixes to tests

@yurii-github yurii-github changed the title WIP: CI, better tests, bugfixes and cleaning CI, better tests, bugfixes and cleaning Nov 15, 2020
@topclaudy
Copy link
Owner

I have finished with my changes.
I will be glad to hear your feedback on code review etc.
If you find it is too big, we can split it in small PRs and I can do it that way, or whatever you think is good.

I have unresolved only 1 thing - I don't know how to forbid user to install illuminate/database 5.6 with PHP 7.3+, because it is laravel issue. maybe some note in readme is enough, I don't know

Also, there is place for improvement like test coverage, because this project is still very risky in sense of changes and tweaks it provides.

regards

FINAL CHANGELOG

Changes

  • dropped requirement for PHP version, it is enforced by illuminate/database package
  • upped support for illuminate/database to 5.6+ (it requires PHP 7.1+ https://packagist.org/packages/illuminate/database#5.6.x-dev)
  • dropped hard dependencies on framework and other useless packages
  • removed Model class as it is not needed
  • removed ComposhipsServiceProvider as it is not needed
  • developer now requires to obtain PHPUnit phar manually

Fixes

  • fixed several bugs for illuminate/database 5.6
  • fixed several bugs for illuminate/database 5.8

Tests

  • added namespaces to tests so they can be resolved with autoload
  • added support for different PHP versions (7.1+)
  • added TravisCI support
  • added Codeclimate support
  • added more tests to cover more edge cases
  • other minor fixes to tests

Very nice! I'll give you feedback before next week.

@topclaudy
Copy link
Owner

All good! There are some unused variables in the tests but that's not an issue (we can clear them later).
How would you suggest to handle tests/Unit/HasManyTest:broken_Compoships_hasOneOrMany_whereInMethod__missingRelationColumn to make it complete? We can put this warning in the doc as a workaround.

@yurii-github
Copy link
Contributor Author

hello. thank you for the feedback

All good! There are some unused variables in the tests but that's not an issue (we can clear them later).
How would you suggest to handle tests/Unit/HasManyTest:broken_Compoships_hasOneOrMany_whereInMethod__missingRelationColumn to make it complete? We can put this warning in the doc as a workaround.

I guess it is directly related to this issue #98
in my view, we should enforce selection of such fields in implicit way somewhere in with() or in some final query builder method.
I can do it in new PR to target that particular issue. So warning is probably ok?

in any case, I have granted you write access to this PR branch, you can change everything you want and I will continue on master after.

regards

@topclaudy topclaudy merged commit 28ebcc0 into topclaudy:master Nov 27, 2020
@topclaudy
Copy link
Owner

Merged! You can go ahead for the PR regarding #98

@yurii-github
Copy link
Contributor Author

thanks.

Small question.. how do I fit code into this styleci.io ? is there any local tool to autofix it?

@topclaudy
Copy link
Owner

thanks.

Small question.. how do I fit code into this styleci.io ? is there any local tool to autofix it?

It provides a diff/patch file you can apply to the code using the git apply [DIFF_FILE] command.

@yurii-github
Copy link
Contributor Author

I see. thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants