public function testEmptyAtInitialization() { $o = new ArrayModel(); $this->assertEquals(0, $o->count()); $this->assertEquals(0, count($o)); $this->assertEquals([], $o->toArray()); }
public function testBasic__getCalledAndByBracketsOperator() { $a = ['test' => uniqid('test:')]; $o = new ArrayModel($a); $this->assertEquals($a['test'], $o->__get('test')); $this->assertEquals($a['test'], $o['test']); }
public function test__setUsingCall() { $value = uniqid('test:'); $key = 'test'; $o = new ArrayModel(); $this->assertNull($o[$key]); $o->__set($key, $value); $this->assertEquals($value, $o[$key]); }
public function testBasicOffsetUnset() { $key = 'test'; $value = uniqid($key . ':'); $a = [$key => $value]; $o = new ArrayModel($a); $this->assertEquals($value, $o[$key]); $o->offsetUnset($key); $this->assertNull($o[$key]); }
public function testOffsetGetWithAndWithoutSetValue() { $key = 'test'; $value = uniqid($key . ':'); $o = new ArrayModel(); $this->assertNull($o->offsetGet($key)); $o->offsetSet($key, $value); $this->assertEquals($value, $o->offsetGet($key)); $this->assertEquals($value, $o[$key]); }
public function testBasicOffsetSet() { $key = 'test'; $value = uniqid($key . ':'); // $a = [$key => $value]; $o = new ArrayModel(); $this->assertFalse($o->offsetExists($key)); $o->offsetSet($key, $value); $this->assertTrue($o->offsetExists($key)); $this->assertEquals($value, $o[$key]); }
public function testOffsetExistsWithAndWithoutCorrectKey() { $key = 'test'; $value = uniqid($key . ':'); $a = [$key => $value]; $o = new ArrayModel($a); $this->assertTrue($o->offsetExists($key)); $this->assertFalse($o->offsetExists(uniqid())); $o->offsetUnset($key); $this->assertFalse($o->offsetExists($key)); }
public function getProperties($bAll = false) { return parent::getProperties($bAll); }