Jakob has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367880 )

Change subject: Remove the dummy data for new lexemes.
......................................................................

Remove the dummy data for new lexemes.

* removes the default populator for lexemes
* changes browser tests to create forms and senses in the frontend which
  is not ideal but probably better than skipping most of them

Bug: T171589
Change-Id: I211643b43c174d03ebb77146aca92dfbf6d69cff
---
M src/Content/LexemeContent.php
D src/DemoData/DefaultPopulator.php
M tests/browser/features/forms.feature
M tests/browser/features/senses.feature
M tests/browser/features/step_definitions/forms_steps.rb
M tests/browser/features/step_definitions/senses_steps.rb
6 files changed, 15 insertions(+), 114 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme 
refs/changes/80/367880/1

diff --git a/src/Content/LexemeContent.php b/src/Content/LexemeContent.php
index dfd3e5f..5856d90 100644
--- a/src/Content/LexemeContent.php
+++ b/src/Content/LexemeContent.php
@@ -66,8 +66,6 @@
                        ( new DemoData\AskOut2Populator() )->populate( $lexeme 
);
                } elseif ( $id === DemoData\Id::L_ASK_OUT ) {
                        ( new DemoData\AskOut3Populator() )->populate( $lexeme 
);
-               } else {
-                       ( new DemoData\DefaultPopulator() )->populate( $lexeme 
);
                }
 
                return $lexeme;
diff --git a/src/DemoData/DefaultPopulator.php 
b/src/DemoData/DefaultPopulator.php
deleted file mode 100644
index 408bc53..0000000
--- a/src/DemoData/DefaultPopulator.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-
-namespace Wikibase\Lexeme\DemoData;
-
-use Wikibase\Lexeme\DataModel\Lexeme;
-use Wikibase\DataModel\Term\Term;
-use Wikibase\DataModel\Term\TermList;
-use Wikibase\Lexeme\DataModel\Sense;
-use Wikibase\Lexeme\DataModel\SenseId;
-
-use DataValues\StringValue;
-use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\DataModel\Entity\PropertyId;
-use Wikibase\DataModel\Snak\PropertyNoValueSnak;
-use Wikibase\DataModel\Snak\PropertyValueSnak;
-use Wikibase\DataModel\Statement\Statement;
-use Wikibase\DataModel\Statement\StatementList;
-use Wikibase\Lexeme\DataModel\Form;
-use Wikibase\Lexeme\DataModel\FormId;
-
-class DefaultPopulator {
-
-       public function populate( Lexeme $lexeme ) {
-               $grammaticalFeatures1 = [ new ItemId( 'Q2' ) ];
-               $grammaticalFeatures2 = [ new ItemId( 'Q2' ), new ItemId( 'Q3' 
) ];
-               $statements1 = new StatementList(
-                       [
-                               new Statement( new PropertyNoValueSnak( new 
PropertyId( 'P2' ) ), null, null, 'guid1' )
-                       ]
-               );
-               $statements2 = new StatementList(
-                       [
-                               new Statement( new PropertyNoValueSnak( new 
PropertyId( 'P2' ) ), null, null, 'guid2' ),
-                               new Statement(
-                                       new PropertyValueSnak(
-                                               new PropertyId( 'P3' ),
-                                               new StringValue( 'asd' )
-                                       ),
-                                       null,
-                                       null,
-                                       'guid3'
-                               ),
-                       ]
-               );
-
-               $forms = [
-                       new Form(
-                               new FormId( 'F1' ),
-                               new TermList( [ new Term( 'en', 'A' ) ] ),
-                               []
-                       ),
-                       new Form(
-                               new FormId( 'F2' ),
-                               new TermList( [ new Term( 'en', 'B' ) ] ),
-                               $grammaticalFeatures1,
-                               $statements1
-                       ),
-                       new Form(
-                               new FormId( 'F3' ),
-                               new TermList( [ new Term( 'en', 'C' ) ] ),
-                               $grammaticalFeatures2,
-                               $statements2
-                       ),
-               ];
-
-               $lexeme->setForms( $forms );
-
-               $senses = [
-                       new Sense(
-                               new SenseId( 'S1' ),
-                               new TermList( [
-                                                                 new Term(
-                                                                         'en',
-                                                                         'A 
mammal, Capra aegagrus hircus, and similar species of the genus Capra.'
-                                                                 ),
-                                                                 new Term(
-                                                                         'fr',
-                                                                         'Un 
mammale, Capra aegagruse hircuse, et similare species de un genuse Capra.'
-                                                                 ),
-                                                         ] ),
-                               new StatementList()
-                       ),
-                       new Sense(
-                               new SenseId( 'S2' ),
-                               new TermList( [ new Term( 'en', 'A scapegoat.' 
) ] ),
-                               new StatementList( [
-                                                                          new 
Statement(
-                                                                               
   new PropertyValueSnak(
-                                                                               
           new PropertyId( 'P900' ),
-                                                                               
           new StringValue( 'informal' )
-                                                                               
   ),
-                                                                               
   null,
-                                                                               
   null,
-                                                                               
   'guid900'
-                                                                          ),
-                                                                  ] )
-                       )
-               ];
-
-               $lexeme->setSenses( $senses );
-       }
-
-}
diff --git a/tests/browser/features/forms.feature 
b/tests/browser/features/forms.feature
index 08e8014..537fe03 100644
--- a/tests/browser/features/forms.feature
+++ b/tests/browser/features/forms.feature
@@ -24,7 +24,6 @@
   @integration
   Scenario: Add grammatical feature
     Given I have a Lexeme with a Form
-     And I am on the page of the Lexeme to test
      And I have an item to test
     When I click on the first Form's edit button
      And I select the test item as the grammatical feature
@@ -34,7 +33,6 @@
   @integration
   Scenario: Remove grammatical feature
     Given I have a Lexeme with a Form
-     And I am on the page of the Lexeme to test
      And a grammatical feature exists for the first Form of the Lexeme
     When I click on the first Form's edit button
      And I remove the first grammatical feature of the first Form
@@ -43,7 +41,6 @@
   @integration
   Scenario: Change multi-variant representations
     Given I have a Lexeme with a Form
-     And I am on the page of the Lexeme to test
     When I click on the first Form's edit button
      And I enter "colors" as the "en-us" form representation
      And I click on the add representation button
@@ -82,5 +79,5 @@
 
   @integration
   Scenario: I can see each Form's statements
-    Then I see at least one Form
-    And for each Form there is a statement list
+    Given I have a Lexeme with a Form
+    Then for each Form there is a statement list
diff --git a/tests/browser/features/senses.feature 
b/tests/browser/features/senses.feature
index 724dce8..56cbe80 100644
--- a/tests/browser/features/senses.feature
+++ b/tests/browser/features/senses.feature
@@ -8,19 +8,21 @@
 
   @integration
   Scenario: Basic senses section
+    Given there is a Sense to test
     Then Senses header should be there
      And Senses container should be there
      And I see at least one Sense
      And for each Sense there is a gloss and an ID
 
-  @integration
+  # TODO: add @integration tag once statements work again
   Scenario: I can see statements of each Sense
     Then I see at least one Sense
     And for each Sense there is a statement list
 
   @integration
   Scenario: Link to Sense
-    And for each Sense there is an anchor equal to its ID
+    Given there is a Sense to test
+    Then for each Sense there is an anchor equal to its ID
 
   @integration
   Scenario: Adding Gloss
diff --git a/tests/browser/features/step_definitions/forms_steps.rb 
b/tests/browser/features/step_definitions/forms_steps.rb
index 608bdc0..7bbe413 100644
--- a/tests/browser/features/step_definitions/forms_steps.rb
+++ b/tests/browser/features/step_definitions/forms_steps.rb
@@ -79,6 +79,11 @@
 
 Given(/^I have a Lexeme with a Form$/) do
   step 'I have a Lexeme to test' # TODO: implement once Forms are storable
+
+  # TODO: Creating the Form should be done on the backend once it is possible
+  step 'I click the Forms list add button'
+  step 'I enter "some representation" as the "en" form representation'
+  step 'I save the Form'
 end
 
 When(/^I click on the first Form's edit button$/) do
diff --git a/tests/browser/features/step_definitions/senses_steps.rb 
b/tests/browser/features/step_definitions/senses_steps.rb
index 055035f..f32460a 100644
--- a/tests/browser/features/step_definitions/senses_steps.rb
+++ b/tests/browser/features/step_definitions/senses_steps.rb
@@ -33,8 +33,10 @@
 end
 
 Given(/^there is a Sense to test$/) do
-  # TODO: All Lexemes have dummy senses at the moment; Needs to be changed 
once they're storable
-  expect(on(LexemePage).senses.count).to be > 0
+  # TODO: Creating the Sense should be done on the backend once it is possible
+  step 'I click on the Senses list add button'
+  step 'I add a Gloss for "en" language with value "some gloss"'
+  step 'I save the Sense'
 end
 
 When(/^I click the first Sense's edit button$/) do

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I211643b43c174d03ebb77146aca92dfbf6d69cff
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Jakob <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to