reecem / mocker Goto Github PK
View Code? Open in Web Editor NEWDynamic PHP object, useful for mocking objects in faking and tests
License: MIT License
Dynamic PHP object, useful for mocking objects in faking and tests
License: MIT License
Hello,
Does this package still working with Maileclipse on laravel 6?
Thanks,
Hey @ReeceM, how can i reach you? email, slack?
Describe the bug
There is the definite chance that a value set on a different object will be returned when it is retrieved from a different one that doesn't come from the same call
To Reproduce
// assign a value to the mocker object
$mocked->value1->sub_value = 2;
echo $mocked->value1->sub_value . PHP_EOL;
// returns int(2)
// now assign that same sub_value to another object or array
$mocked->assoc_arr['sub_value'] = 'Must be different value';
echo $mocked->assoc_arr['sub_value'];
// returns 2
// but
echo $mocked->sub_value;
// returns 2
echo $mocked->value1->sub_value;
// returns 2
Expected behavior
This should not do that and has a problem to do with the flat structure of the VarStore and the way in which the values are resolved.
The VarStore should be structured as the way in which the values should be called i.e.:
// calling
$mocked->sub_value; // would return 'null' or 'mocked->sub_value';
or
$mocked->value1->sub_value; // gives 2
and
$mocked->assoc_arr['sub_value']; // will give the string
Describe the bug
The object class Mocked
cannot have calls to arrays done on it.
This is raised on the dependent package on Qoraiche/laravel-mail-editor#30
To Reproduce
Steps to reproduce the behavior:
Call and array on an object that is mocked. It can be done using multi-dimensions and also just single.
e.g. `$this->data['group']['name']
Expected behavior
Should return a value for the array, even if it has multiple calls to itself
Screenshots
screenshots on this issue here
Qoraiche/laravel-mail-editor#30
affects
Hello @ReeceM
Please refer to this issue:
Qoraiche/laravel-mail-editor#52
When a object is assigned to a value e.g.:
$mocked->value['sub_value'] = 'stripes'
echo $mocked->value;
// returns
// mocked->value
What would be nicer is that when the value is called with __toString()
which triggers that reaction of printing a formatted
[
"sub_value" => 'stripes'
]
or if the values is just called by the magic __get
it should return the value as a php array type, instead of assuming that it may be calling another dynamically generated value.
Is your feature request related to a problem? Please describe.
Package currently does not support Laravel 7, blocking the ability to upgrade for any projects that use this library directly or any packages that require this library.
Describe the solution you'd like
Add support for illuminate/filesystem to ^7.0
Describe alternatives you've considered
Only possible alternative is to remove any package that requires this library
Hi,
First, I want to say thank you for creating this Mock class,
It would be great if you make the mocked arguments output more user readable and complex, so we can use it within MailEclipse previews.
Line 39 in 73a2854
This line returns a simple string mocked varname
.
Needed Result:
{{ varname }}
Including $vars
when defined:
{{ varname->complex->var }}
Thanks,
qoraiche.
I would like to move completely away from the dependency on the Illuminate packages.
Mainly to make it not restricted in the versions, thinner and also a little more portable.
I could make use and reference the license back to the Illuminate/Laravel for function patterns that I use. Or roll my own.
Nice things is that the package then can be used in any type of PHP project.
Marginally questioning the benefit though. Note to self.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.