From b62012bf3da994298ad52a4ccec06e814bcc5a79 Mon Sep 17 00:00:00 2001 From: nickw Date: Fri, 9 Oct 2009 17:11:25 +0000 Subject: Creating an ElggObject unit test. Fixing issues with the unit test plugin hooks, as well as infinite looping bugs introduced by the unit test skeleton. git-svn-id: http://code.elgg.org/elgg/trunk@3519 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/tests/objects/objects.php | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 engine/tests/objects/objects.php (limited to 'engine/tests/objects/objects.php') diff --git a/engine/tests/objects/objects.php b/engine/tests/objects/objects.php new file mode 100644 index 000000000..c9600ab6e --- /dev/null +++ b/engine/tests/objects/objects.php @@ -0,0 +1,68 @@ +entity = new ElggObjectTest(); + } + + /** + * Called after each test method. + */ + public function tearDown() { + unset($this->entity); + } + + /** + * Called after each test object. + */ + public function __destruct() { + parent::__destruct(); + } + + /** + * A basic test that will be called and fail. + */ + public function testElggEntityConstructor() { + $attributes = array(); + $attributes['guid'] = ''; + $attributes['type'] = 'object'; + $attributes['subtype'] = ''; + $attributes['owner_guid'] = get_loggedin_userid(); + $attributes['container_guid'] = get_loggedin_userid(); + $attributes['site_guid'] = 0; + $attributes['access_id'] = ACCESS_PRIVATE; + $attributes['time_created'] = ''; + $attributes['time_updated'] = ''; + $attributes['enabled'] = 'yes'; + $attributes['tables_split'] = 2; + $attributes['tables_loaded'] = 0; + $attributes['title'] = ''; + $attributes['description'] = ''; + + $this->assertIdentical($this->entity->expose_attributes(), $attributes); + } +} + +class ElggObjectTest extends ElggObject { + public function expose_attributes() { + return $this->attributes; + } +} -- cgit v1.2.3