Пример #1
0
 /**
  * @tags utilities
  */
 public function testMixin()
 {
     _::mixin(['foo' => function () {
         return 'bar';
     }]);
     $this->string(_::foo())->isEqualTo('bar');
 }
function _mixin($functions)
{
    return Underscore::mixin($functions);
}
Пример #3
0
 public function testMixin()
 {
     Underscore::mixin(['falsey' => function ($collection) {
         $output = clone $collection;
         foreach ($collection as $k => $v) {
             if (!empty($v)) {
                 unset($output[$k]);
             }
         }
         return $output;
     }]);
     $value = Underscore::from($this->getDummy2())->falsey()->toArray();
     $this->assertSame($value, ['false' => false, 'null' => null, 'zero' => 0]);
     $value = Underscore::from($this->getDummy())->falsey()->toArray();
     $this->assertSame($value, []);
 }