public function testIsEmpty() { // from js $this->assertFalse(__u::isEmpty(array(1)), 'array(1) is not empty'); $this->assertTrue(__u::isEmpty(array()), 'array() is empty'); $this->assertFalse(__u::isEmpty((object) array('one' => 1), '(object) array("one"=>1) is not empty')); $this->assertTrue(__u::isEmpty(new StdClass()), 'new StdClass is empty'); $this->assertTrue(__u::isEmpty(null), 'null is empty'); $this->assertTrue(__u::isEmpty(''), 'the empty string is empty'); $this->assertFalse(__u::isEmpty('moe'), 'but other strings are not'); $obj = (object) array('one' => 1); unset($obj->one); $this->assertTrue(__u::isEmpty($obj), 'deleting all the keys from an object empties it'); // extra $this->assertFalse(__u(array(1))->isEmpty(), 'array(1) is not empty with OO-style call'); $this->assertTrue(__u(array())->isEmpty(), 'array() is empty with OO-style call'); $this->assertTrue(__u(null)->isEmpty(), 'null is empty with OO-style call'); // docs $stooge = (object) array('name' => 'moe'); $this->assertFalse(__u::isEmpty($stooge)); $this->assertTrue(__u::isEmpty(new StdClass())); $this->assertTrue(__u::isEmpty((object) array())); }