Task #2123

Refactor (Object) Framework unit tests

Added by Robert Lemke over 11 years ago. Updated over 9 years ago.

Should have
Start date:
Due date:
% Done:


PHP Version:
Has patch:


Currently most of the Object Framework's tests are rather functional tests than unit tests. Even worse, most of them depend on a real package, the "TestPackage".

The tests should be refactored so they
  • are true unit tests
  • don't depend on another package but come with their own fixtures

Additionally get rid of using the object manager and/or factory of the "outer" FLOW3, making it possible to run the tests completely without needing a FLOW3 instance.

Associated revisions

Revision aef750e4 (diff)
Added by Robert Lemke over 11 years ago

  • FLOW3: (Object) Refactored the Object Manager and mostly rewrote all related unit tests. They now don't depend on the TestPackage anymore, are true unit tests and reach a code coverage close to 100%. Addresses #2123
  • FLOW3: (Object) Rename the "Object Cache" to "Object Registry"

Revision dee6ef71 (diff)
Added by Karsten Dambekalns over 11 years ago

  • refactored a bunch of unit tests so they no longer need a real FLOW3 to run, refs #2123

Revision adde6ecc (diff)
Added by Robert Lemke over 11 years ago

This is a big commit (sorry - not exactly Continuous Integration ...)
While all seems to be fine and stable, many features introduced in this commit are not complete. Especially AOP Proxy Caching, Logging (API), the System Logger and the Signal Slots mechanism need some further work.

  • TYPO3 Distribution: Added a Log directory
  • TYPO3 Distribution: Disabled security (for now) because some thing need to be refactored and tested again after this commit
  • FLOW3: Further cleanup of the bootstrap. Addresses #2117
  • FLOW3: Removed manual registration of objects from all classes and created an Objects.yaml configuration instead which declares the objects and configures their dependencies. This manual registration is necessary for objects such as the AOP Framework because at the time it is created, the Object Manager is not yet fully initialized.
  • FLOW3: (AOP) Refactored and cleaned up the AOP initialization process. Resolves #441.
  • FLOW3: (AOP) Completely rewrote all unit tests and added many new ones. Now no AOP test relies on the TestPackage anymore. Addresses #1868
  • FLOW3: (AOP) Improved the automatic documentation rendering of the Proxy Class Builder. Resolves #35.
  • FLOW3: (AOP) Externalized the creation of the AOP proxy and instead use the Caches.yaml configuration.
  • FLOW3: (AOP) Removed all use of PHP's Reflection classes and replaced them with calls to the Reflection Service
  • FLOW3: (AOP) Converted all classes involved in the proxy building process from static into dynamic calls
  • FLOW3: (Cache) Introduced an (semi) automatic cache registration feature which assures that all necessary caches are registered when file changes are detected. In order to register a cache, just define it in the new "Caches.yaml" configuration file. See the FLOW3 package for examples. Resolves #1787
  • FLOW3: (Cache) Wrote more tests for the File Backend. Resolves #1843
  • FLOW3: (Configuration) Improved the performance of the special configuration management
  • FLOW3: (Configuration) Added support for Caches.* configuration
  • FLOW3: (Error) The exception handlers now log uncaught exceptions to the System Logger
  • FLOW3: (Monitor) Introduced a new sub package "Monitor" which provides a mechanism for automatic detection of changes on monitored files. If monitored files or directories (the latter not yet implemented) change, a signal is emitted which can be catched by a slot taking further action. Currently all cache entries tagged with a class tag are flushed automatically if a class file changes.
  • FLOW3: (Log) Introduced a special System Logger which is created automatically and can be injected if needed. Although it works quite well already, the general concept of injecting the logger and the LoggerInterface itself is not final! Watch for log files in the Data/Log/ directory when running TYPO3 / FLOW3 in development context.
  • FLOW3: (Log) Introduced a Logger Factory for use in Objects configuration. Warning: the API might still change
  • FLOW3: (Log) Made the SEVERITY constants conform to RFC3164 and PHP's LOG_* constants
  • FLOW3: (Object) Refactored and detached more unit tests from the TestPackage. Addresses #2123
  • FLOW3: (Object) Implemented an early configuration parse step which allows for configuring objects in the Objects.yaml file of the FLOW3 package even before the Package Manager is initialized.
  • FLOW3: (Object) Introduced a lifecycle shutdown method (default is "shutdownObject") which can be used as a clean alternative to __destruct().
  • FLOW3: (Reflection) Added new API methods: isClassReflected, getInterfaceNamesImplementedByClass, isMethodFinal, isMethodStatic, isMethodPublic, isMethodProtected, isMethodPrivate
  • FLOW3: (Reflection) getMethods() now returns information about the method visibility
  • FLOW3: (Security) Refactored the ACL Policy Service - might still need some final work
  • FLOW3: (SignalSlot) Fixed some small issues in the Dispatcher and implemented support for System Logger
  • FLOW3: (Utility) Fixed a bug in Arrays::getValueByPath
  • Testing: Implemented a method buildAccessibleProxy() in the BaseTestCase which allows for conveniently calling protected methods of a class. See FLOW3 unit tests for examples.
  • TestPackage: Removed many classes which became obsolete due to the AOP tests refactoring. refs #1868

Revision cfee0bf0 (diff)
Added by Robert Lemke over 10 years ago

[+FEATURE] FLOW3 (Object): Implemented a static object container which is automatically built. It's essentially a hardcoded version of the autowired and configured object dependencies - just a lot faster. Many tests are still missing, but the version in this commit should be mostly functional. Addresses #3740 and resolves #2123.
[!!!][~API] FLOW3 (Object): Heavily refactored the Object Manager and its tests. The most important change is the removal of the Object Factory whose create() method is now located in the Object Manager. Furthermore, the getObject() method has been renamed to get() and a few minor important API functions within the Object Manager have been modified. This commit also contains a script which allows for semi automatically migrating existing code to the new API (see ./flow3 migrate objectmanagerusage). Resolves #6562
[~TASK] FLOW3 (Configuration): The Configuration Manager and its YAML source now doesn't depend on the YAML package anymore but refers to a YAML parser class within the FLOW3 package. Resolves #6564.


#1 Updated by Karsten Dambekalns over 11 years ago

  • Subject changed from Refactor Object Framework unit tests to Refactor (Object) Framework unit tests
  • Assignee changed from Robert Lemke to Karsten Dambekalns

#2 Updated by Karsten Dambekalns over 11 years ago

  • % Done changed from 0 to 40

Also with r1658: some MVC tests refactored

#3 Updated by Karsten Dambekalns over 11 years ago

  • Assignee deleted (Karsten Dambekalns)

I need a break from this one, feel free to assign it...

#4 Updated by Robert Lemke about 11 years ago

  • Target version changed from 1.0 alpha 1 to 283

#5 Updated by Robert Lemke almost 11 years ago

  • Target version deleted (283)

#6 Updated by Robert Lemke over 10 years ago

  • Assignee set to Robert Lemke
  • Target version set to 1.0 alpha 8

#7 Updated by Robert Lemke over 10 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 40 to 100

Applied in changeset r3837.

Also available in: Atom PDF