Esempio n. 1
0
 public function testReflectsNonInheritedPropertiesOfClassWithRightValues()
 {
     $size = mt_rand(0, 999);
     $tested = new Circle(1, 2, $size);
     $classInfo = WidgetReflector::reflect($tested);
     $this->assertArrayHasKey('size', $classInfo['properties']);
     $this->assertEquals('size=' . $size, $classInfo['properties']['size']);
     $this->assertThat($classInfo['properties'], $this->logicalNot($this->arrayHasKey('diameterH')));
     $diameterH = mt_rand(0, 999);
     $diameterY = mt_rand(0, 999);
     $tested = new Ellipse(1, 2, $diameterH, $diameterY);
     $classInfo = WidgetReflector::reflect($tested);
     $this->assertArrayHasKey('diameterH', $classInfo['properties']);
     $this->assertArrayHasKey('diameterY', $classInfo['properties']);
     $this->assertEquals('diameterH=' . $diameterH, $classInfo['properties']['diameterH']);
     $this->assertEquals('diameterY=' . $diameterY, $classInfo['properties']['diameterY']);
 }
Esempio n. 2
0
 public function __toString()
 {
     $innerWidgetProperties = WidgetReflector::reflect($this->innerWidget);
     $properties = WidgetReflector::reflect($this);
     return sprintf('%s (%s, %s) %s %s', $properties['name'], $this->x, $this->y, implode(' ', $innerWidgetProperties['properties']), implode(' ', $properties['properties']));
 }
Esempio n. 3
0
 public function __toString()
 {
     $classInfo = WidgetReflector::reflect($this);
     return sprintf('%s (%s, %s) %s', $classInfo['name'], $this->x, $this->y, implode(' ', $classInfo['properties']));
 }