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

- Refactoring to Laravel 8 Class Model Factories. #5190

Merged
merged 9 commits into from Oct 7, 2021

Conversation

AbdullahFaqeir
Copy link
Contributor

Issue Reference

#5165

Description

Dropping laravel legacy factories and refactor all models to use laravel 8 class factories, and some other code refactoring.

How To Test This?

Run tests.

@devansh-webkul
Copy link
Member

Hi @AbdullahFaqeir and @ghermans,

This PR is huge, it will take time as I am taking pull also. Meanwhile, I am opening the test case.

@devansh-webkul
Copy link
Member

Hi @AbdullahFaqeir,

My local test cases are failing, please have a look,

Screenshot from 2021-10-04 15-19-57

I exited in the middle because already CI is failing.

@AbdullahFaqeir
Copy link
Contributor Author

I'll go over the test cases again and will update the PR accordingly

@ghermans
Copy link
Contributor

ghermans commented Oct 4, 2021

@devansh-webkul not only the local tests are failing, even on Github they are failing

- update codeception driver for laravel.
Copy link
Member

@devansh-webkul devansh-webkul left a comment

Choose a reason for hiding this comment

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

There are some changes we need to do,

  • As going through all the files, it looks like your prettier or code beautifier has removed all the spaces. Please go through it, I mentioned in some.
  • Mostly new lines are added before and opening classes.
  • Traits imports can be done in single line rather than multiple uses.

composer.json Outdated Show resolved Hide resolved
database/factories/UserFactory.php Outdated Show resolved Hide resolved
packages/Webkul/Attribute/src/Models/Attribute.php Outdated Show resolved Hide resolved
packages/Webkul/Sales/src/Models/Invoice.php Outdated Show resolved Hide resolved
@devansh-webkul
Copy link
Member

@abdulhamid-alattar,

Hi just summarised here also because files are 92,
#5190 (review)

Meanwhile, test cases are still failing. I am re-running again for you but in my local, it's also failing.

- Code reformat.
- Remove codeception/module-laravel5 as it was causing trigger testing to fail since it's outdated and we already upgraded factories to laravel 8.
Copy link
Member

@devansh-webkul devansh-webkul left a comment

Choose a reason for hiding this comment

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

Its looks fine to me just a PSR-2 standards are missing. Please check all the files, i haven't go through the files but the same things are missing in all files.

database/factories/UserFactory.php Show resolved Hide resolved
database/factories/UserFactory.php Show resolved Hide resolved
packages/Webkul/Core/src/Helpers/Laravel5Helper.php Outdated Show resolved Hide resolved
packages/Webkul/Core/src/Helpers/Laravel5Helper.php Outdated Show resolved Hide resolved
packages/Webkul/Core/src/Helpers/Laravel5Helper.php Outdated Show resolved Hide resolved
packages/Webkul/Core/src/Helpers/Laravel5Helper.php Outdated Show resolved Hide resolved
@AbdullahFaqeir
Copy link
Contributor Author

@devansh-webkul is everything okay?

@ghermans
Copy link
Contributor

ghermans commented Oct 5, 2021

@AbdullahFaqeir please check the feedback that @devansh-webkul provided 4 hours ago

@AbdullahFaqeir
Copy link
Contributor Author

@AbdullahFaqeir please check the feedback that @devansh-webkul provided 4 hours ago

I did, handled them in my last commit.

@devansh-webkul
Copy link
Member

Hi @AbdullahFaqeir,

Most of the files, PSR-2 standard missing.

Maybe your extension automatically doing it.

@devansh-webkul
Copy link
Member

Hi @abdulhamid-alattar,

Any update on this?

@AbdullahFaqeir
Copy link
Contributor Author

AbdullahFaqeir commented Oct 6, 2021

Hi @abdulhamid-alattar,

Any update on this?

you mean @AbdullahFaqeir hahahah,

I'm using phpStorm, can you help me regarding the code style thingy?

@AbdullahFaqeir
Copy link
Contributor Author

@devansh-webkul I just check the whole system against PSR2 using PHP_CodeSniffer, and seems like the whole system is missing PSR-2 Standards!

phpcs --standard=PSR2 ./bagisto

The output is infinitely long.

@devansh-webkul
Copy link
Member

This is 99 files and I already commented on most of the files.

Just go through all the comments, this will help you.

@devansh-webkul
Copy link
Member

@devansh-webkul I just check the whole system against PSR2 using PHP_CodeSniffer, and seems like the whole system is missing PSR-2 Standards!

phpcs --standard=PSR2 ./bagisto

The output is infinitely long.

Most of the files are following PSR-2 Standards. Just have a look at the files, there are some files in which changes are just styled the code.

@devansh-webkul
Copy link
Member

@AbdullahFaqeir
Copy link
Contributor Author

Hi @AbdullahFaqeir,

Check this,

https://github.com/bagisto/bagisto/pull/5190/files#r723163466

Okay, I'll go over them file by file, my changed files (99) file and I'll update the PR

@devansh-webkul
Copy link
Member

I can help you with this.

I will comment where changes are needed after you commit.

- Fixing typo.
@AbdullahFaqeir
Copy link
Contributor Author

@devansh-webkul I have reviewed all 99 files each by it self and fixed the new lines and the extra spaces in all of them.

@devansh-webkul
Copy link
Member

I am checking, will let you know about this.

Copy link
Member

@devansh-webkul devansh-webkul left a comment

Choose a reason for hiding this comment

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

Hi @AbdullahFaqeir,

Just check the unresolved conversation, for your convenience, I just checked all the files thoroughly.

Only a few changes left.

packages/Webkul/Core/src/Helpers/Laravel5Helper.php Outdated Show resolved Hide resolved
packages/Webkul/Core/src/Models/Channel.php Outdated Show resolved Hide resolved
packages/Webkul/Core/src/Models/Channel.php Outdated Show resolved Hide resolved
packages/Webkul/Product/src/Models/Product.php Outdated Show resolved Hide resolved
database/factories/UserFactory.php Outdated Show resolved Hide resolved
Copy link
Member

@devansh-webkul devansh-webkul left a comment

Choose a reason for hiding this comment

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

Only one file left.

packages/Webkul/Core/src/Helpers/Laravel5Helper.php Outdated Show resolved Hide resolved
packages/Webkul/Core/src/Helpers/Laravel5Helper.php Outdated Show resolved Hide resolved
packages/Webkul/Core/src/Helpers/Laravel5Helper.php Outdated Show resolved Hide resolved
@devansh-webkul
Copy link
Member

Hi @AbdullahFaqeir,

  • Only one file left please check.

  • And also resolve conflict.

- Fix conflict.
@AbdullahFaqeir
Copy link
Contributor Author

@devansh-webkul I've fixed both the CS and the conflict.

@devansh-webkul
Copy link
Member

Okay! Now everything seems fine to me. I am opening the test case and checking my local instance also.

@AbdullahFaqeir
Copy link
Contributor Author

Okay! Now everything seems fine to me. I am opening the test case and checking my local instance also.

Great, looking forward for the merge. <3

@devansh-webkul
Copy link
Member

Just checking in my local. I Will let you know.

@devansh-webkul
Copy link
Member

  • All test cases are passing.

  • Admin working fine.

    Screenshot

  • Shop working fine.

    Screenshot(1)

@AbdullahFaqeir Thanks for the contribution. 🚀

@AbdullahFaqeir
Copy link
Contributor Author

I'mm honoured that I managed to help 🚀 🚀 🚀.

@ghermans ghermans merged commit 916cd18 into bagisto:master Oct 7, 2021
@ghermans
Copy link
Contributor

ghermans commented Oct 7, 2021

Thank you for your contribution @AbdullahFaqeir

@AbdullahFaqeir
Copy link
Contributor Author

Thank you for your contribution @AbdullahFaqeir

You're most welcome, glad I managed to help ❤️

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.

None yet

3 participants