Skip to content

Pushes all solution files into temp when created #209

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

Merged
merged 4 commits into from
May 18, 2021

Conversation

mikeymike
Copy link
Member

@mikeymike mikeymike commented May 17, 2021

Part 1 of ? that replaces #201 with a more sane implementation in smaller more digestible chunks 😄

This will ensure that our internal solutions are moved into temp before running which in turn allows us to patch the files without any impact to our actual solutions. The risk of breaking these solutions from a users code is high as it essentially breaks the whole workshop

mikeymike added 3 commits May 17, 2021 23:33
In temp mapper  moves files of solution so we
can no longer check against file paths expected
as they're always random in temp. Instead we now
compare contents to ensure it's as we expect.
This ensures we can keep state allowing invoking
the same solution multiple times and not doing
FS operations everytime.

Side benefit is solutions will not require caching
@mikeymike
Copy link
Member Author

Updated with hopefully passing tests. I refactored some of the tests to hopefully make it more robust and separate the concerns away from knowing the expected path values.

@AydinHassan I also put some comments into each commit if you wanted to review the changes of each with a little more context 😄

Let me know what you think about this approach

Mainly around file paths not being what was expected

I chose to compare contents rather than paths as it felt
more robust, hower the temp paths are deterministic I just
didn't want to crossover logic / concerns of this into these
@mikeymike mikeymike force-pushed the feature/in-temp-solution-mapping branch from 1eb405d to 08af37a Compare May 18, 2021 00:04
@AydinHassan AydinHassan merged commit 3eaf6ae into master May 18, 2021
@AydinHassan
Copy link
Member

@mikeymike nice work, LGTM. I also appreciate the commit comments 👌

public function tearDown(): void
{
$fileSystem = new Filesystem();
$fileSystem->remove(Path::join(realpath(sys_get_temp_dir()), 'php-school'));
Copy link
Member

Choose a reason for hiding this comment

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

Probably could have used \PhpSchool\PhpWorkshop\Utils\System::tempDir('php-school') and in a few other places not that it really matters

@mikeymike mikeymike deleted the feature/in-temp-solution-mapping branch May 18, 2021 08:59
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.

2 participants