Giter Site home page Giter Site logo

getsettrait's People

Contributors

angelxmoreno avatar rakshazi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

getsettrait's Issues

Implement a hasData method

I have a use case where it would be useful to be able to test whether or not a property has been assigned. Being able to call a $dummy->hasFoo() method that returns a boolean indicating whether the property has been set.

Unable to mock (using Mockery) classes using this trait

If in unit testing, try to mock classes using this trait with the Mockery library an error occurs:

ErrorException: Declaration of Mockery_2_Class_Name_Here::__call($method, $args) should be compatible with Class\Name\Here::__call($method = NULL, $params = Array)

The issue is that Mockery replaces the __call method of it's own, and the declaration of the parameters doesn't match. Mockery should probably take care to ensure it doesn't do that, but in this case I think getSetTrait is partially at fault.

The __call magic method is invoked when you attempt to call a method that doesn't exist, so the first param (the method name) will always be supplied. Likewise if the method was called with no params, the second parameter will be an empty array, so that will also always be supplied. Hence there's no value in declaring these as optional, and changing that fixes the issue with mocking as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.