コード例 #1
0
ファイル: __constructTest.php プロジェクト: bogdananton/vsc
 public function testEmptyAtInitialization()
 {
     $o = new ArrayModel();
     $this->assertEquals(0, $o->count());
     $this->assertEquals(0, count($o));
     $this->assertEquals([], $o->toArray());
 }
コード例 #2
0
ファイル: __getTest.php プロジェクト: bogdananton/vsc
 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']);
 }
コード例 #3
0
ファイル: __setTest.php プロジェクト: bogdananton/vsc
 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]);
 }
コード例 #4
0
ファイル: offsetUnsetTest.php プロジェクト: bogdananton/vsc
 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]);
 }
コード例 #5
0
ファイル: offsetGetTest.php プロジェクト: bogdananton/vsc
 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]);
 }
コード例 #6
0
ファイル: offsetSetTest.php プロジェクト: bogdananton/vsc
 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]);
 }
コード例 #7
0
ファイル: offsetExistsTest.php プロジェクト: bogdananton/vsc
 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));
 }
コード例 #8
0
ファイル: getPropertiesTest.php プロジェクト: bogdananton/vsc
 public function getProperties($bAll = false)
 {
     return parent::getProperties($bAll);
 }