Example #1
0
 public function testIsObject()
 {
     $object = new stdClass();
     $this->assertEquals(__::isObject($object), true);
     $notObject = '1';
     $this->assertEquals(__::isObject($notObject), false);
 }
Example #2
0
 public function testIsObject()
 {
     // Arrange
     $a = 'fred';
     // Act
     $x = __::isObject($a);
     // Assert
     $this->assertEquals(false, $x);
 }
 public function testIsObject()
 {
     // from js
     $this->assertTrue(__::isObject((object) array(1, 2, 3)));
     $this->assertTrue(__::isObject(function () {
     }), 'and functions');
     $this->assertFalse(__::isObject(null), 'but not null');
     $this->assertFalse(__::isObject('string'), 'and not string');
     $this->assertFalse(__::isObject(12), 'and not number');
     $this->assertFalse(__::isObject(true), 'and not boolean');
     if (class_exists('DateTimeZone')) {
         $this->assertTrue(__::isObject(new DateTimeZone('America/Denver')), 'objects are');
     }
     // extra
     $this->assertTrue(__::isObject(new StdClass()), 'empty objects work');
     $this->assertTrue(__(new StdClass())->isObject(), 'works with OO-style call');
     $this->assertFalse(__(2)->isObject());
 }