public function testSize() { // from js $items = (object) array('one' => 1, 'two' => 2, 'three' => 3); $this->assertEquals(3, __::size($items), 'can compute the size of an object'); // extra $this->assertEquals(0, __::size(array())); $this->assertEquals(1, __::size(array(1))); $this->assertEquals(3, __::size(array(1, 2, 3))); $this->assertEquals(6, __::size(array(null, false, array(), array(1, 2, array('a', 'b')), 1, 2))); $this->assertEquals(3, __(array(1, 2, 3))->size(), 'works with OO-style calls'); // docs $stooge = new StdClass(); $stooge->name = 'moe'; $stooge->age = 40; $this->assertEquals(2, __::size($stooge)); }