GithubHelp home page GithubHelp logo

oliverklee / ext-oelib Goto Github PK

View Code? Open in Web Editor NEW
0.0 4.0 8.0 12.84 MB

TYPO3 library extension "oelib"

Home Page: https://www.oliverklee.de/typo3-services/seminarmanager/

License: GNU General Public License v2.0

PHP 100.00% HTML 0.01%
typo3-cms-extension typo3 hacktoberfest php

ext-oelib's Introduction

"One Is Enough" library TYPO3 extension

TYPO3 V11 TYPO3 V12 License Total Downloads GitHub CI Status Coverage Status

This extension provides useful stuff for extension development: helper functions for unit testing, templating and automatic configuration checks.

Most of the documentation is in ReST format in the Documentation/ folder and is rendered as part of the TYPO3 documentation.

Running the tests locally

You will need to have a Git clone of the extension for this with the Composer dependencies installed.

Running the unit tests

On the command line

To run all unit tests on the command line:

composer ci:tests:unit

To run all unit tests in a directory or file (using the directory Tests/Unit/Model/ as an example):

.Build/vendor/bin/phpunit -c .Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml Tests/Unit/Model/

In PhpStorm

First, you need to configure the path to PHPUnit in the settings:

Languages & Frameworks > PHP > Test Frameworks

In this section, configure PhpStorm to use the Composer autoload and the script path .Build/vendor/autoload.php within your project.

In the Run/Debug configurations for PHPUnit, use an alternative configuration file:

.Build/vendor/typo3/testing-framework/Resources/Core/Build/UnitTests.xml

Running the functional tests

You will need a local MySQL user that has the permissions to create new databases.

In the examples, the following credentials are used:

  • user name: typo3
  • password: typo3pass
  • DB name prefix: typo3_test (optional)
  • DB host: localhost (omitted as this is the default)

You will need to provide those credentials as environment variables when running the functional tests:

  • typo3DatabaseUsername
  • typo3DatabasePassword
  • typo3DatabaseName

On the command line

To run all functional tests on the command line:

typo3DatabaseUsername=typo3 typo3DatabasePassword=typo3pass typo3DatabaseName=typo3_test composer ci:tests:functional

To run all functional tests in a directory or file (using the directory Tests/Functional/Authentication/ as an example):

typo3DatabaseUsername=typo3 typo3DatabasePassword=typo3pass typo3DatabaseName=typo3_test .Build/vendor/bin/phpunit -c .Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests.xml Tests/Functional/Authentication/

In PhpStorm

First, you need to configure the path to PHPUnit in the settings:

Languages & Frameworks > PHP > Test Frameworks

In this section, configure PhpStorm to use the Composer autoload and the script path .Build/vendor/autoload.php within your project.

In the Run/Debug configurations for PHPUnit, use an alternative configuration file:

.Build/vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTests.xml

Also set the following environment variables in your runner configuration:

  • typo3DatabaseUsername
  • typo3DatabasePassword
  • typo3DatabaseName

ext-oelib's People

Contributors

abhinayvjk avatar bouche avatar braunson avatar davidjakob avatar dependabot[bot] avatar emilkneu avatar jokumer avatar konafets avatar lochmueller avatar oliverklee avatar pascal20997 avatar webermann avatar

Watchers

 avatar  avatar  avatar  avatar

ext-oelib's Issues

Drop the old @lazy annotation

from the ParentModel class. Only keep the new annotation.

Blocked by #406.

5) Tests/Unit/Domain/Fixtures/ParentModel.php:3

    ---------- begin diff ----------
@@ @@

 namespace OliverKlee\Oelib\Tests\Unit\Domain\Fixtures;

+use TYPO3\CMS\Extbase\Annotation as Extbase;
 use OliverKlee\Oelib\Domain\Model\Traits\CachedAssociationCount;
 use TYPO3\CMS\Extbase\Annotation\ORM\Lazy;
 use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
@@ @@
     /**
      * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\OliverKlee\Oelib\Tests\Unit\Domain\Fixtures\ParentModel>
      * @Lazy
-     * @lazy
+     * @Extbase\ORM\Lazy
      */
     protected $children = null;

Fix use of deprecated core API

As far as possible while maintaining compatibility with TYPO3 8.7 and 9.5.

PhpStorm's code inspection will find the usage of deprecated code.

Depends on #416.

TypeError in Tx_Oelib_Template::getMarker()

I'm implementing a hook in seminars, and need to get marker values a from Tx_Oelib_Template. On integer values I get an exception:

(1/1) TypeError
Return value of Tx_Oelib_Template::getMarker() must be of the type string, integer returned
in /var/www/html/public/typo3conf/ext/oelib/Classes/Template.php line 226

     */
    public function getMarker(string $markerName): string
    {
        $unifiedMarkerName = $this->createMarkerName($markerName);
        return $this->markers[$unifiedMarkerName] ?? '';
    }

    /**
     * Sets a subpart's content.

at Tx_Oelib_Template->getMarker('number_of_registrations')
...

Cast to string in getMarker() or set type hint in setMarker() to ensure only strings are passed in (which will produce a multitude of errors at other places until casting to string everywhere).

Fix most instances of extension scanner warnings for TYPO3 7, 8, 9

Fix the issues in code that will not be removed in oelib 4.0 anyway. We might need version-dependent code here (with version switches). For things that require a bigger refactoring, we need separate tickets, and we might need to move them to the 4.0 milestone.

We might split this up into multiple PRs.

Blocked by #387.

Fix use of deprecated core API

As far as possible while maintaining compatibility with TYPO3 9.5 and 10.4.

PhpStorm's code inspection will find the usage of deprecated code.

Depends on #406.

Check/update/fix the language handling

Check the SalutationSwitcher class, whether detection of the current FE and BE language is still correct in TYPO3 8/9/10, check whether the language labels are still read correctly, and fix any issues and add tests as needed.

Blocked by #467 and #498.

Failed check for logged in users

FrontendLoginManager does not really check if fe_user is really logged. This ends i an exception in for example EXT:realty where tx_realty_Mapper_FrontendUser not exists, but is expected.

Require PHP >= 7.2

… and drop support for PHP 7.0 and 7.1.

This affects composer.json, the ext_emconf.php and Resources/Private/Php/.

This is only about changing the requirements, not about changing the code.

Namespace all classes and rename some

All classes should be properly PSR-4-namespaced, including the test cases and fixture classes, also also including the deprecated classes.

The namespacing schema should follow the already namespaced classes and the existing tests. If the test case names and the tested class names differ, the new names should follow the names of the test cases.

We need proper migrations and a class alias map (with the old classes being marked as deprecated and to be removed in oelib 4.0.0).

We should have one PR per renamed/moved class or namespace (if the classes are really small).

Add badge for TYPO3 compatility

Like this:

![TYPO3 compatibility](https://img.shields.io/badge/TYPO3-8.7%20%7C%209.5-orange?maxAge=3600&style=flat-square&logo=typo3)

Migrate to PHPUnit 7.5

Also add the corresponding fixer rules and use new assertions (as suggested by PhpStorm's code inspection).

Depends on #405

moveByRandomDistance may move too much

  1. OliverKlee\Oelib\Tests\Unit\Geocoding\CalculatorTest::moveByRandomDistanceMovesAtMostByGivenDistanceWithPositiveDistance with data set "N" (90)
    Failed asserting that 100.0078663189693 is equal to 100.0 or is less than 100.0.

Add a visibility to all class constants

The visibility should be as narrow as possible: private, protected or public. We need to check whether seminars uses a constant.

Also drop the corresponding exception from phpcs.xml.dist.

Blocked by #405.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.