Esempio n. 1
0
 public function testEmptyAtInitialization()
 {
     $o = new ArrayModel();
     $this->assertEquals(0, $o->count());
     $this->assertEquals(0, count($o));
     $this->assertEquals([], $o->toArray());
 }
Esempio n. 2
0
 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']);
 }
Esempio n. 3
0
 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]);
 }
Esempio n. 4
0
 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]);
 }
Esempio n. 5
0
 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]);
 }
Esempio n. 6
0
 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]);
 }
Esempio n. 7
0
 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));
 }
Esempio n. 8
0
 public function getProperties($bAll = false)
 {
     return parent::getProperties($bAll);
 }