[TASK] Use ext:styleguide in acceptance tests 41/47541/9
authorChristian Kuhn <lolli@schwarzbu.ch>
Thu, 7 Apr 2016 20:58:59 +0000 (22:58 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Mon, 11 Apr 2016 12:22:22 +0000 (14:22 +0200)
Adds styleguide as require-dev composer dependency and
call the data generator for acceptance tests.

Change-Id: I917b732face3c9d194ef88bada18e3195562a6dc
Resolves: #75481
Releases: master
Reviewed-on: https://review.typo3.org/47541
Reviewed-by: Sascha Egerer <sascha@sascha-egerer.de>
Tested-by: Sascha Egerer <sascha@sascha-egerer.de>
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
composer.json
composer.lock
typo3/sysext/core/Tests/Acceptance/Backend/Page/AddPageInPageModuleCest.php
typo3/sysext/core/Tests/AcceptanceCoreEnvironment.php

index 1c532c4..94e146b 100644 (file)
@@ -54,7 +54,8 @@
                "phpunit/phpunit": "~5.2.0",
                "mikey179/vfsStream": "~1.6.0",
                "codeception/codeception": "^2.1",
-               "se/selenium-server-standalone": "~2.53"
+               "se/selenium-server-standalone": "~2.53",
+               "7elix/styleguide": "~8.0.0"
        },
        "suggest": {
                "ext-gd": "GDlib/Freetype is required for building images with text (GIFBUILDER) and can also be used to scale images",
index 2e6757e..a717d39 100644 (file)
@@ -4,8 +4,8 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "dcc7f3710b29a0a989d3cb526ded9760",
-    "content-hash": "934285f91691c38a5c9c6f61a9bb4d3b",
+    "hash": "8d5c9b829baf959723f0331b902a6950",
+    "content-hash": "6223c70de09731f9587fc3bd4c52e970",
     "packages": [
         {
             "name": "cogpowered/finediff",
     ],
     "packages-dev": [
         {
+            "name": "7elix/styleguide",
+            "version": "8.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/7elix/TYPO3.CMS.Styleguide.git",
+                "reference": "95efabd7505cee5ad60993e024578cc7e1e0b295"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/7elix/TYPO3.CMS.Styleguide/zipball/95efabd7505cee5ad60993e024578cc7e1e0b295",
+                "reference": "95efabd7505cee5ad60993e024578cc7e1e0b295",
+                "shasum": ""
+            },
+            "require": {
+                "typo3/cms-core": ">=8.0,<9.0"
+            },
+            "type": "typo3-cms-extension",
+            "autoload": {
+                "psr-4": {
+                    "TYPO3\\CMS\\Styleguide\\": "Classes/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "GPL-2.0+"
+            ],
+            "authors": [
+                {
+                    "name": "Felix Kopp",
+                    "email": "felix-source@phorax.com",
+                    "homepage": "http://phorax.com",
+                    "role": "Developer"
+                }
+            ],
+            "description": "TYPO3 CMS Backend Styleguide",
+            "homepage": "https://github.com/7elix/TYPO3.CMS.Styleguide",
+            "keywords": [
+                "style guide",
+                "typo3"
+            ],
+            "time": "2016-04-07 20:21:25"
+        },
+        {
             "name": "codeception/codeception",
             "version": "2.1.7",
             "source": {
index 803b1dd..cf74354 100644 (file)
@@ -54,6 +54,11 @@ class AddPageInPageModuleCest
 
         // Switch to content frame
         $I->switchToIFrame('content');
+
+        // New page select position wizard
+        $I->click('i[title="Insert the new page here"]');
+
+        // FormEngine new page record
         $saveButton = 'body > div > div.module-docheader.t3js-module-docheader > div.module-docheader-bar.module-docheader-bar-buttons.t3js-module-docheader-bar.t3js-module-docheader-bar-buttons > div.module-docheader-bar-column-left > div > div > button:nth-child(1)';
         $I->waitForElement($saveButton);
 
@@ -94,7 +99,7 @@ class AddPageInPageModuleCest
         $yesButtonPopup = '#-main > div.x-window.x-window-plain.x-window-dlg > div.x-window-bwrap > div.x-window-bl > div > div > div > div.x-panel-fbar.x-small-editor.x-toolbar-layout-ct > table > tbody > tr > td.x-toolbar-left > table > tbody > tr > td:nth-child(2) > table > tbody > tr:nth-child(2) > td.x-btn-mc > em > button';
         $I->waitForElement($yesButtonPopup);
         $I->click($yesButtonPopup);
-        $I->wait(1);
+        $I->wait(2);
         $I->cantSee('Testpage');
     }
 }
index 95df805..bcf55ba 100644 (file)
@@ -18,6 +18,8 @@ use Codeception\Event\SuiteEvent;
 use Codeception\Events;
 use Codeception\Extension;
 use TYPO3\CMS\Core\Cache\Backend\NullBackend;
+use TYPO3\CMS\Core\Core\Bootstrap;
+use TYPO3\CMS\Styleguide\TcaDataGenerator\Generator;
 
 /**
  * This codeception extension creates a full TYPO3 instance within
@@ -174,7 +176,12 @@ class AcceptanceCoreEnvironment extends Extension
         }
         $testbase->createLastRunTextfile($instancePath);
         $testbase->setUpInstanceCoreLinks($instancePath);
-        $testbase->linkTestExtensionsToInstance($instancePath, $this->testExtensionsToLoad);
+        // ext:styleguide is always loaded
+        $testExtensionsToLoad = array_merge(
+            [ 'typo3conf/ext/styleguide' ],
+            $this->testExtensionsToLoad
+        );
+        $testbase->linkTestExtensionsToInstance($instancePath, $testExtensionsToLoad);
         $testbase->linkPathsInTestInstance($instancePath, $this->pathsToLinkInTestInstance);
         $localConfiguration = $testbase->getOriginalDatabaseSettingsFromEnvironmentOrLocalConfiguration();
         $originalDatabaseName = $localConfiguration['DB']['database'];
@@ -191,7 +198,8 @@ class AcceptanceCoreEnvironment extends Extension
         $localConfiguration['SYS']['debugExceptionHandler'] = '';
         $localConfiguration['SYS']['trustedHostsPattern'] = 'localhost:8000';
         $localConfiguration['SYS']['encryptionKey'] = 'iAmInvalid';
-        $localConfiguration['SYS']['setDBinit'] = 'SET SESSION sql_mode = \'STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY\';';
+        // @todo: This sql_mode should be enabled as soon as styleguide and dataHandler can cope with it
+        //$localConfiguration['SYS']['setDBinit'] = 'SET SESSION sql_mode = \'STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY\';';
         $localConfiguration['SYS']['caching']['cacheConfigurations']['extbase_object']['backend'] = NullBackend::class;
         $testbase->setUpLocalConfiguration($instancePath, $localConfiguration, $this->configurationToUseInTestInstance);
         $defaultCoreExtensionsToLoad = [
@@ -213,7 +221,7 @@ class AcceptanceCoreEnvironment extends Extension
             'sv',
             'scheduler'
         ];
-        $testbase->setUpPackageStates($instancePath, $defaultCoreExtensionsToLoad, $this->coreExtensionsToLoad, $this->testExtensionsToLoad);
+        $testbase->setUpPackageStates($instancePath, $defaultCoreExtensionsToLoad, $this->coreExtensionsToLoad, $testExtensionsToLoad);
         $testbase->setUpBasicTypo3Bootstrap($instancePath);
         $testbase->setUpTestDatabase($localConfiguration['DB']['database'], $originalDatabaseName);
         $testbase->loadExtensionTables();
@@ -228,5 +236,16 @@ class AcceptanceCoreEnvironment extends Extension
         foreach ($this->xmlDatabaseFixtures as $fixture) {
             $testbase->importXmlDatabaseFixture(ORIGINAL_ROOT . $fixture);
         }
+
+        // styleguide generator uses DataHandler for some parts. DataHandler needs an initialized BE user
+        // with admin right and the live workspace.
+        Bootstrap::getInstance()->initializeBackendUser();
+        $GLOBALS['BE_USER']->user['admin'] = 1;
+        $GLOBALS['BE_USER']->user['uid'] = 1;
+        $GLOBALS['BE_USER']->workspace = 0;
+        Bootstrap::getInstance()->initializeLanguageObject();
+
+        $styleguideGenerator = new Generator();
+        $styleguideGenerator->create();
     }
 }