ElggExtenderTest.php 970 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. class ElggExtenderTest extends \PHPUnit_Framework_TestCase {
  3. public function testSettingAndGettingAttribute() {
  4. $obj = $this->getMockForAbstractClass('\ElggExtender');
  5. $obj->name = 'comment';
  6. $this->assertEquals('comment', $obj->name);
  7. }
  8. public function testGettingNonexistentAttribute() {
  9. $obj = $this->getMockForAbstractClass('\ElggExtender');
  10. $this->assertNull($obj->foo);
  11. }
  12. public function testSettingValueAttribute() {
  13. $obj = $this->getMockForAbstractClass('\ElggExtender');
  14. $obj->value = '36';
  15. $this->assertSame('36', $obj->value);
  16. $this->assertEquals('text', $obj->value_type);
  17. $obj->value = 78;
  18. $this->assertSame(78, $obj->value);
  19. $this->assertEquals('integer', $obj->value_type);
  20. }
  21. public function testSettingValueExplicitly() {
  22. $obj = $this->getMockForAbstractClass('\ElggExtender');
  23. $obj->setValue('36', 'integer');
  24. $this->assertSame(36, $obj->value);
  25. $this->assertEquals('integer', $obj->value_type);
  26. }
  27. }