ElggRelationshipTest.php 639 B

12345678910111213141516171819202122
  1. <?php
  2. class ElggRelationshipTest extends \PHPUnit_Framework_TestCase {
  3. public function testSettingAndGettingAttribute() {
  4. $obj = $this->getRelationshipMock();
  5. $obj->relationship = 'hasSister';
  6. $this->assertEquals('hasSister', $obj->relationship);
  7. }
  8. public function testGettingNonexistentAttribute() {
  9. $obj = $this->getRelationshipMock();
  10. $this->assertNull($obj->foo);
  11. }
  12. protected function getRelationshipMock() {
  13. // do not call constructor because it would cause deprecation warnings
  14. // and deprecation is not test-friendly yet.
  15. return $this->getMockForAbstractClass('\ElggRelationship', array(), '', false);
  16. }
  17. }