Skip to content

Conversation

@dg
Copy link
Member

@dg dg commented Jan 21, 2017

  • new feature? yes
  • BC break? no

This can be used mocking of final classes/members and also as foundation for #17

@dg dg force-pushed the mutator branch 4 times, most recently from c06cf16 to 3645807 Compare January 21, 2017 19:07
dg referenced this pull request in nette/utils Jan 22, 2017
This reverts commit "Christmas Gift 2013" 0dfe244.
Copy link
Member

@milo milo left a comment

Choose a reason for hiding this comment

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

👍 Nice start. I like the file:// "hack" :)

if ($content === FALSE) {
return FALSE;
} else {
$this->handle = tmpfile();
Copy link
Member

Choose a reason for hiding this comment

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

It opens file in w+ mode, not sure it's important or not.

@fprochazka
Copy link
Contributor

image

What a lovely hack (no sarcasm). Muggles will enjoy using this to hack libraries with final in their applications :)

@JanTvrdik
Copy link
Contributor

JanTvrdik commented Mar 8, 2017

Should I write to php-internals mailing list suggestion to disallow this?
I still feel like this is too evil to be allowed to exist.

@f3l1x
Copy link
Member

f3l1x commented Apr 28, 2017

Thats amazing feature. Can't wait.

@milo milo added this to the 2.0 milestone May 2, 2017
milo pushed a commit to milo/tester that referenced this pull request May 3, 2017
@milo
Copy link
Member

milo commented May 3, 2017

Merged 8c9d656. Let's experiment.

@milo milo closed this May 3, 2017
@dg
Copy link
Member Author

dg commented May 3, 2017

That's a bit premature, I do not like current API. FileMutator::register() means nothing, it should be enabled via something like Environment::bypassFinals().

@milo
Copy link
Member

milo commented May 3, 2017

Oh, sorry. I removed it from master. I misunderstood you on PoSobota.

@milo milo reopened this May 3, 2017
@dg dg force-pushed the master branch 3 times, most recently from c7e8a12 to df5e87f Compare July 24, 2017 14:21
@milo milo modified the milestones: 2.x, 2.0 Aug 15, 2017
@dg dg force-pushed the mutator branch 2 times, most recently from 82cddf2 to d2c42ed Compare August 16, 2017 13:33
@dg dg changed the title added FileMutator [WIP] added FileMutator Aug 16, 2017
@dg
Copy link
Member Author

dg commented Aug 16, 2017

From my point this is ready to squash and merge.

@milo
Copy link
Member

milo commented Aug 16, 2017

👍

@dg dg merged commit 721dc05 into nette:master Aug 16, 2017
@dg dg deleted the mutator branch August 16, 2017 19:09
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.

5 participants