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

Refactor/62 cleanup #76

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open

Refactor/62 cleanup #76

wants to merge 46 commits into from

Conversation

nozavroni
Copy link
Owner

No description provided.

nozavroni and others added 30 commits December 28, 2016 03:11
After a whole lot of refactoring and adding ALL of the new methods I wanted to add, I have finally gotten a SINGLE testcase class passing. So I'm committing it. This commit covers a LOT of ground though. I'll try to list all of it but I'm sure I'll miss something:

* Added indexOf() method - refs #20
* Added random() method - refs #39
* Added namespaced helper functions collect(), invoke(), is_traversable(), is_arrayable(), to_array(), and typeof() - refs #42
* Renamed getValueAtPosition() and getKeyAtPosition() to getOffset() and getOffsetKey() - refs #45
* Added CollectionInterface - refs #39
* Added Arrayable support with ArrayableInterface and is_arrayable() - refs #23
* Using Laravel's collections for inspiration, I rounded out my main collection mehods which are defined in CollectionInterface - refs #30
* Added to_array() method which is somewhat similar to Laravel's getArrayableItems(), but it still needs some work - refs #31
* A whole bunch of other minor changes

I still need to get the remaining unit tests working and I need to add unit tests for the new methods I added with this commit.
Removed NumericCollection and AbstractCollection, leaving only Collection and CollectionInterface - resolves #50
* Removed all methods that required mutability from both CollectionInterface and Collection.
* For methods such as set() and add(), I simulate this functionality by returning a new collection with these methods performed on it.
* Removed unit tests that tested methods mentioned in my previous point because they test for those methods as if collections were mutable. So I will need to update the tests to test the return collection for changes and test that the original collection did not change.

refs #52
Added some methods to my base unit test case class that allows me to "watch" an object over the course of a test and then at the end, assert that it has not changed in any discernable way. This will help me immensely while trying to unit test that my collection methods are respecting collection object immutability. I have implemented this assert method in all existing tests that warrant it.
Added _() function, contextual function somewhat like jQuery's $(). Does different things depending what you pass to it. Right now it supports two operations only, but I will likely add more (if I decide to keep it).

* alias for invoke() _(function() {})
* alias for collect() _([1,2,3])
* alias for with()/() _(new SomeClass)->doSomething()

References #55
Very minor changes to implementation of Collection::setData().
Implemented and unit tested the Collection::zip() method - refs #47
* Added bracket index (offset and negative offset) access to Sequence collections.
* Added bracking slice access using $seq['start:end'] syntax (returns an array)
* Added IsArrayable trait to Sequence
* Implemented and added tests for Sequence methods "pipe", "every", "none", and "first"
Luke Visinoni and others added 11 commits January 8, 2017 15:18
* Added "phpunit/php-code-coverage" to dev dependencies
* Ran composer update
According to my code coverage reports, several Noz\* functions had still yet to be unit tested, either in part, or at all. This commit should cover every function in the Noz namespace. - refs #47
 * Renamed Lst -> LList
 * Refactored Sequence::__invoke() because I intend to do something similar with LList
@coveralls
Copy link

Coverage Status

Coverage decreased (-37.02%) to 60.804% when pulling 4680214 on refactor/62-cleanup into 7523f46 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-37.02%) to 60.804% when pulling 6eb3946 on refactor/62-cleanup into 7523f46 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-37.02%) to 60.804% when pulling 143eb62 on refactor/62-cleanup into 7523f46 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-37.3%) to 60.5% when pulling 638190e on refactor/62-cleanup into 7523f46 on master.

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