/**
  * set() should return void
  */
 public function test_set_returnsVoid()
 {
     $instance = new Child();
     $property = new RefractionProperty($instance, Child::PROPERTY_PUBLIC);
     $this->assertNull($property->set('foo'));
     $this->assertEquals('foo', $instance->{Child::PROPERTY_PUBLIC});
     return;
 }
Example #2
0
 /**
  * Returns true if the property is visible to the object
  *
  * A property is visible to a calling class if the property is public (and 
  * visible to any calling class) or the calling class is this class (and the 
  * property protected or private).
  *
  * @param   Jstewmc\Refraction\RefractionProperty  $property  the property
  * @param   object  $object  the calling class
  * @return  bool
  * @since   0.1.0
  */
 protected final function isPropertyVisible($property, $object)
 {
     return $property->isPublic() || $object === $this;
 }
Example #3
0
 /**
  * Attaches a property to the entity
  *
  * Keep in mind, I'm trusting you to have checked to be sure the property doesn't
  * already exist. Otherwise, I will overwrite an existing transient property and
  * mayhem could ensue!
  *
  * @param   Jstewmc\Refraction\RefractionProperty  $property  the property
  * @return  self
  * @since   0.1.0
  */
 protected final function attachProperty(RefractionProperty $property)
 {
     $this->transientProperties[$property->getName()] = $property;
     return $this;
 }