Skip to content

Commit 4661c15

Browse files
author
Stefano Kowalke
committed
[WIP] Make the ExtensionAPI compatible to TYPO3 CMS 6.2
* updateList * fetch * listMirrors * import * add Unit Tests * vfsStream is necessary for Unit Tests. But we don't add this as a dependency to the extension. Instead we use the one which is defined in cores composer file. For installation copy the composer.json from the core package to your webroot and execute `composer install`. This will install some dependencies into Packages/Libraries. * Add Travis CI configuration file and status image * Add Scrutinizer configuration and status images * Update README.md Resolve TYPO3-coreapi#51 Resolve TYPO3-coreapi#55 Resolve TYPO3-coreapi#69 Resolve TYPO3-coreapi#72 Resolve TYPO3-coreapi#73 Resolve TYPO3-coreapi#74 Resolve TYPO3-coreapi#76 Resolve TYPO3-coreapi#77 Resolve TYPO3-coreapi#78 Resolve TYPO3-coreapi#79 Resolve TYPO3-coreapi#80 Resolve TYPO3-coreapi#82 Resolve TYPO3-coreapi#83 Resolve TYPO3-coreapi#84 Resolve TYPO3-coreapi#85
1 parent e339ef2 commit 4661c15

23 files changed

+3895
-537
lines changed

Diff for: .scrutinizer.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
filter:
2+
excluded_paths:
3+
- 'Resources/Public/vendor/*'
4+
- 'Tests/*'
5+
6+
tools:
7+
8+
external_code_coverage:
9+
timeout: 700
10+
11+
php_sim: true
12+
13+
php_code_sniffer:
14+
enabled: true
15+
command: phpcs -n
16+
config:
17+
standard: TYPO3CMS
18+
19+
php_cs_fixer: false
20+
21+
php_mess_detector:
22+
enabled: true
23+
config:
24+
code_size_rules:
25+
cyclomatic_complexity: true
26+
npath_complexity: true
27+
excessive_class_complexity: true
28+
controversial_rules:
29+
superglobals: false
30+
31+
php_pdepend: true
32+
33+
php_analyzer:
34+
enabled: true
35+
config:
36+
basic_semantic_checks:
37+
enabled: true
38+
property_on_interface: true
39+
missing_abstract_methods: true
40+
deprecation_checks:
41+
enabled: true
42+
simplify_boolean_return:
43+
enabled: true
44+
metrics_lack_of_cohesion_methods:
45+
enabled: true
46+
dead_assignments:
47+
enabled: true
48+
49+
sensiolabs_security_checker: true

Diff for: .travis.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
language: php
2+
php:
3+
- 5.3
4+
- 5.4
5+
- 5.5
6+
- 5.6
7+
8+
env:
9+
- DB=mysql TYPO3=coreapi/develop INTEGRATION=master COVERAGE=0
10+
11+
services:
12+
- memcached
13+
- redis-server
14+
15+
notifications:
16+
email:
17+
18+
slack:
19+
rooms:
20+
- typo3:DHkQdCNWc6x2znPAYA5T2LXO#gsoc-coreapi
21+
22+
before_script:
23+
# Get latest git version cause of travis issues (https://github.com/travis-ci/travis-ci/issues/1710)
24+
- sudo apt-get update && sudo apt-get install git parallel tree
25+
- >
26+
if [[ "$TRAVIS_PHP_VERSION" = "5.3" || "$TRAVIS_PHP_VERSION" = "5.4" ]]; then
27+
echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini;
28+
echo "apc.enable_cli=1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini;
29+
echo "apc.slam_defense=0" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini;
30+
pecl install igbinary > /dev/null;
31+
fi
32+
- echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
33+
- echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
34+
- cd ..
35+
- git clone --single-branch --branch $INTEGRATION --depth 1 git://github.com/TYPO3-coreapi/TYPO3-Travis-Integration.git build-environment
36+
- source build-environment/install-helper.sh
37+
- git clone --single-branch --branch $TYPO3 --depth 1 https://github.com/TYPO3-coreapi/TYPO3CMS.git core
38+
- mv core/* .
39+
- composer self-update
40+
- composer --dev install
41+
- mkdir -p fileadmin uploads typo3temp typo3conf/ext/
42+
- mv ext-coreapi typo3conf/ext/coreapi
43+
44+
script:
45+
- phpLint typo3conf/ext/coreapi
46+
- >
47+
echo;
48+
echo "Running unit tests";
49+
./bin/phpunit --colors --coverage-clover=coverage.clover -c typo3/sysext/core/Build/UnitTests.xml typo3conf/ext/coreapi/Tests/Unit/
50+
- wget https://scrutinizer-ci.com/ocular.phar
51+
- cp -R typo3conf/ext/coreapi/.git .
52+
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover

Diff for: Classes/Command/CacheApiCommandController.php

+18-21
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,27 @@
3535
*/
3636
class CacheApiCommandController extends CommandController {
3737

38+
/**
39+
* @var \Etobi\CoreAPI\Service\CacheApiService
40+
*/
41+
protected $cacheApiService;
42+
43+
/**
44+
* Inject the CacheApiService
45+
*
46+
* @param \Etobi\CoreAPI\Service\CacheApiService $cacheApiService
47+
*/
48+
public function injectCacheApiService(\Etobi\CoreAPI\Service\CacheApiService $cacheApiService) {
49+
$this->cacheApiService = $cacheApiService;
50+
}
51+
3852
/**
3953
* Clear all caches.
4054
*
4155
* @return void
4256
*/
4357
public function clearAllCachesCommand() {
44-
$service = $this->getService();
45-
$service->clearAllCaches();
46-
58+
$this->cacheApiService->clearAllCaches();
4759
$this->outputLine('All caches have been cleared.');
4860
}
4961

@@ -53,9 +65,7 @@ public function clearAllCachesCommand() {
5365
* @return void
5466
*/
5567
public function clearConfigurationCacheCommand() {
56-
$service = $this->getService();
57-
$service->clearConfigurationCache();
58-
68+
$this->cacheApiService->clearConfigurationCache();
5969
$this->outputLine('Configuration cache has been cleared.');
6070
}
6171

@@ -65,9 +75,7 @@ public function clearConfigurationCacheCommand() {
6575
* @return void
6676
*/
6777
public function clearPageCacheCommand() {
68-
$service = $this->getService();
69-
$service->clearPageCache();
70-
78+
$this->cacheApiService->clearPageCache();
7179
$this->outputLine('Page cache has been cleared.');
7280
}
7381

@@ -78,18 +86,7 @@ public function clearPageCacheCommand() {
7886
* @return void
7987
*/
8088
public function clearAllExceptPageCacheCommand() {
81-
$service = $this->getService();
82-
$clearedCaches = $service->clearAllExceptPageCache();
83-
89+
$clearedCaches = $this->cacheApiService->clearAllExceptPageCache();
8490
$this->outputLine('Cleared caches: ' . implode(', ', $clearedCaches));
8591
}
86-
87-
/**
88-
* Returns the service object.
89-
*
90-
* @return \Etobi\CoreAPI\Service\CacheApiService object
91-
*/
92-
private function getService() {
93-
return $this->objectManager->get('Etobi\\CoreAPI\\Service\\CacheApiService');
94-
}
9592
}

0 commit comments

Comments
 (0)