Rjain has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/81555


Change subject: PHP Unit tests for Annotation Repository
......................................................................

PHP Unit tests for Annotation Repository

Change-Id: I89897f1b56485016d4f561a148dd1d08845aaa31
---
A tests/AnnotationRepositoryTest.php
1 file changed, 45 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Annotator 
refs/changes/55/81555/1

diff --git a/tests/AnnotationRepositoryTest.php 
b/tests/AnnotationRepositoryTest.php
new file mode 100644
index 0000000..a23fb4d
--- /dev/null
+++ b/tests/AnnotationRepositoryTest.php
@@ -0,0 +1,45 @@
+<?php
+
+class AnnotationRepositoryTest extends MediawikiLangTestCase {
+       protected $sample;
+
+       protected $annotationSample;
+
+       protected $tablesUsed = array( 'annotator.sql' );
+
+       protected function setUp() {
+               parent::setUp();
+               //set up the tables
+               $this->db->begin();
+
+               //set the annotation object to a arbritary value
+               $annotationSample = '';
+               $annotationSample->user->id = '';
+               $annotationSample->user->username = '';
+
+               //initialize the sample object
+               $this->sample = new AnnotationRepository;
+       }
+       protected function tearDown() {
+               unset($this->sample);
+               unset($this->annotationSample);
+               parent::tearDown();
+       }
+       public function testReadAnnotations() {
+               /*
+               @group database
+               */
+               $this->db->insert(
+                       'annotator',
+                       array(
+                               'annotation_json' => '',
+                               'annotation_rev_id' => '',
+                               'annotation_user_id' => ''
+                               )
+                       );
+               $annotation_id = $this->db->insertId(); //get the annotation ID
+
+               $annotation = $this->sample->get( $annotation_id );
+
+               $this->assertEquals( $annotationSample, $annotation );
+}
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/81555
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I89897f1b56485016d4f561a148dd1d08845aaa31
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Annotator
Gerrit-Branch: master
Gerrit-Owner: Rjain <richa.jain1...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to