Skip to content

Commit

Permalink
Merge branch '4.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Aug 20, 2018
2 parents 425e14a + 5a65e7a commit ccab809
Show file tree
Hide file tree
Showing 14 changed files with 328 additions and 44 deletions.
42 changes: 26 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: php

git:
depth: 1
depth: 5

cache:
directories:
Expand All @@ -15,7 +15,7 @@ env:
- COMPOSER_ALLOW_XDEBUG=0
- SYMFONY_DEPRECATIONS_HELPER='weak_vendors'

matrix:
jobs:
include:
# Latest dependencies with all PHP versions
- php: 7.1
Expand All @@ -25,10 +25,6 @@ matrix:
- php: nightly
env: COMPOSER_FLAGS='--ignore-platform-reqs'

# Split the monorepo
- php: 7.2
env: MONOREPO_SPLIT=true

# Generate the coverage with the latest PHP version
- php: 7.2
env: COVERAGE='--exclude-group contao3'
Expand All @@ -38,9 +34,15 @@ matrix:
env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable'
- php: 7.2
env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable'

# Split the monorepo
- stage: split
if: 'type = push AND branch =~ /^(master|\d+\.\d+)$/'
php: 7.2
script: php vendor/bin/monorepo-tools composer-json --validate && php vendor/bin/monorepo-tools split $TRAVIS_BRANCH --cache-dir $HOME/.monorepo-split-cache

allow_failures:
- php: nightly
fast_finish: true

before_install:
- if [[ ! $COVERAGE ]]; then phpenv config-rm xdebug.ini || true; fi
Expand All @@ -51,15 +53,23 @@ install:
- composer update $COMPOSER_FLAGS --no-interaction --no-suggest

script:
- if [[ $COVERAGE ]]; then mkdir -p build/logs; fi
- if [[ $COVERAGE ]]; then php vendor/bin/phpunit -c calendar-bundle $COVERAGE --coverage-clover build/logs/calendar-bundle.xml; else php vendor/bin/phpunit -c calendar-bundle; fi
- if [[ $COVERAGE ]]; then php vendor/bin/phpunit -c core-bundle $COVERAGE --coverage-clover build/logs/core-bundle.xml; else php vendor/bin/phpunit -c core-bundle; fi
- if [[ $COVERAGE ]]; then php vendor/bin/phpunit -c faq-bundle $COVERAGE --coverage-clover build/logs/faq-bundle.xml; else php vendor/bin/phpunit -c faq-bundle; fi
- if [[ $COVERAGE ]]; then php vendor/bin/phpunit -c installation-bundle $COVERAGE --coverage-clover build/logs/installation-bundle.xml; else php vendor/bin/phpunit -c installation-bundle; fi
- if [[ $COVERAGE ]]; then php vendor/bin/phpunit -c manager-bundle $COVERAGE --coverage-clover build/logs/manager-bundle.xml; else php vendor/bin/phpunit -c manager-bundle; fi
- if [[ $COVERAGE ]]; then php vendor/bin/phpunit -c news-bundle $COVERAGE --coverage-clover build/logs/news-bundle.xml; else php vendor/bin/phpunit -c news-bundle; fi
- |
if [[ $COVERAGE ]]; then
mkdir -p build/logs
php vendor/bin/phpunit -c calendar-bundle $COVERAGE --coverage-clover build/logs/calendar-bundle.xml
php vendor/bin/phpunit -c core-bundle $COVERAGE --coverage-clover build/logs/core-bundle.xml
php vendor/bin/phpunit -c faq-bundle $COVERAGE --coverage-clover build/logs/faq-bundle.xml
php vendor/bin/phpunit -c manager-bundle $COVERAGE --coverage-clover build/logs/manager-bundle.xml
php vendor/bin/phpunit -c news-bundle $COVERAGE --coverage-clover build/logs/news-bundle.xml
else
php vendor/bin/phpunit -c calendar-bundle
php vendor/bin/phpunit -c core-bundle
php vendor/bin/phpunit -c faq-bundle
php vendor/bin/phpunit -c installation-bundle
php vendor/bin/phpunit -c manager-bundle
php vendor/bin/phpunit -c news-bundle
fi
- php vendor/bin/phpstan analyse core-bundle/src core-bundle/tests --level=3 --no-progress
- if [[ $MONOREPO_SPLIT == true && $TRAVIS_EVENT_TYPE == "push" ]]; then composer require contao/monorepo-tools:dev-master; vendor/bin/monorepo-tools split $TRAVIS_BRANCH --cache-dir $HOME/.monorepo-split-cache; fi

after_script:
- if [[ $COVERAGE ]]; then php vendor/bin/php-coveralls -x build/logs/calendar-bundle.xml -x build/logs/core-bundle.xml -x build/logs/faq-bundle.xml -x build/logs/installation-bundle.xml -x build/logs/manager-bundle.xml -x build/logs/news-bundle.xml; fi
- if [[ $COVERAGE ]]; then php vendor/bin/php-coveralls -x build/logs/calendar-bundle.xml -x build/logs/core-bundle.xml -x build/logs/faq-bundle.xml -x build/logs/manager-bundle.xml -x build/logs/news-bundle.xml; fi
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Contao 4 bundles

[![](https://img.shields.io/travis/contao/contao/master.svg?style=flat-square)](https://travis-ci.org/contao/contao/)
[![](https://img.shields.io/coveralls/contao/contao/master.svg?style=flat-square)](https://coveralls.io/github/contao/contao)
[![](https://img.shields.io/packagist/v/contao/contao.svg?style=flat-square)](https://packagist.org/packages/contao/contao)
[![](https://img.shields.io/packagist/dt/contao/contao.svg?style=flat-square)](https://packagist.org/packages/contao/contao)

This is a monorepo holding the official Contao 4 bundles.

Contao is an Open Source PHP Content Management System for people who want a
Expand All @@ -24,7 +29,7 @@ The monorepo is split into separate packages automatically:
* [NewsletterBundle](https://github.com/contao/newsletter-bundle)

**Please do not use `contao/contao` in production** but use the split packages
insteead.
instead.

## Running scripts

Expand Down
75 changes: 75 additions & 0 deletions calendar-bundle/tests/Picker/EventPickerProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

use Contao\BackendUser;
use Contao\CalendarBundle\Picker\EventPickerProvider;
use Contao\CalendarEventsModel;
use Contao\CalendarModel;
use Contao\CoreBundle\Picker\PickerConfig;
use Contao\TestCase\ContaoTestCase;
use Knp\Menu\FactoryInterface;
Expand Down Expand Up @@ -202,4 +204,77 @@ public function testConvertsTheDcaValue(): void
{
$this->assertSame('{{event_url::5}}', $this->provider->convertDcaValue(new PickerConfig('link'), 5));
}

public function testAddsTableAndIdIfThereIsAValue(): void
{
$calendarEvents = $this->createMock(CalendarEventsModel::class);
$calendarEvents
->expects($this->once())
->method('getRelated')
->with('pid')
->willReturn($this->mockClassWithProperties(CalendarModel::class, ['id' => 1]))
;

$config = new PickerConfig('link', [], '{{event_url::1}}', 'eventPicker');

$adapters = [
CalendarEventsModel::class => $this->mockConfiguredAdapter(['findById' => $calendarEvents]),
];

$this->provider->setFramework($this->mockContaoFramework($adapters));

$method = new \ReflectionMethod(EventPickerProvider::class, 'getRouteParameters');
$method->setAccessible(true);
$params = $method->invokeArgs($this->provider, [$config]);

$this->assertSame('calendar', $params['do']);
$this->assertSame('tl_calendar_events', $params['table']);
$this->assertSame(1, $params['id']);
}

public function testDoesNotAddTableAndIdIfThereIsNoEventsModel(): void
{
$config = new PickerConfig('link', [], '{{event_url::1}}', 'eventPicker');

$adapters = [
CalendarEventsModel::class => $this->mockConfiguredAdapter(['findById' => null]),
];

$this->provider->setFramework($this->mockContaoFramework($adapters));

$method = new \ReflectionMethod(EventPickerProvider::class, 'getRouteParameters');
$method->setAccessible(true);
$params = $method->invokeArgs($this->provider, [$config]);

$this->assertSame('calendar', $params['do']);
$this->assertArrayNotHasKey('tl_calendar_events', $params);
$this->assertArrayNotHasKey('id', $params);
}

public function testDoesNotAddTableAndIdIfThereIsNoCalendarModel(): void
{
$calendarEvents = $this->createMock(CalendarEventsModel::class);
$calendarEvents
->expects($this->once())
->method('getRelated')
->with('pid')
->willReturn(null)
;

$config = new PickerConfig('link', [], '{{event_url::1}}', 'eventPicker');

$adapters = [
CalendarEventsModel::class => $this->mockConfiguredAdapter(['findById' => $calendarEvents]),
];

$this->provider->setFramework($this->mockContaoFramework($adapters));

$method = new \ReflectionMethod(EventPickerProvider::class, 'getRouteParameters');
$method->setAccessible(true);
$params = $method->invokeArgs($this->provider, [$config]);

$this->assertSame('calendar', $params['do']);
$this->assertArrayNotHasKey('tl_calendar_events', $params);
$this->assertArrayNotHasKey('id', $params);
}
}
3 changes: 3 additions & 0 deletions comments-bundle/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Contao 4 comments bundle

[![](https://img.shields.io/packagist/v/contao/comments-bundle.svg?style=flat-square)](https://packagist.org/packages/contao/comments-bundle)
[![](https://img.shields.io/packagist/dt/contao/comments-bundle.svg?style=flat-square)](https://packagist.org/packages/contao/comments-bundle)

The comments bundle adds comments functionality to Contao 4.

Contao is an Open Source PHP Content Management System for people who want a
Expand Down
70 changes: 46 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"contao-components/tinymce4": "^4.7",
"contao/image": "^0.3.5",
"contao/imagine-svg": "^0.1.2 || ^0.2",
"contao/manager-plugin": "^2.6",
"contao/manager-plugin": "^2.6.2",
"doctrine/dbal": "^2.5",
"doctrine/doctrine-bundle": "^1.7.2",
"doctrine/doctrine-cache-bundle": "^1.3",
Expand Down Expand Up @@ -69,30 +69,16 @@
"sensiolabs/ansi-to-html": "^1.1",
"simplepie/simplepie": "^1.3",
"spomky-labs/otphp": "^9.1",
"symfony/http-kernel": "^4.1",
"symfony/monolog-bridge": "^4.1",
"symfony/monolog-bundle": "^3.1",
"symfony/swiftmailer-bundle": "^3.1.5",
"symfony/symfony": "3.4.* || 4.0.* || 4.1.*",
"tecnickcom/tcpdf": "^6.0",
"terminal42/header-replay-bundle": "^1.4.2",
"toflar/psr6-symfony-http-cache-store": "^1.0.2",
"true/punycode": "^2.1",
"twig/twig": "^1.26 || ^2.0",
"webmozart/path-util": "^2.0"
"twig/twig": "^1.26 || ^2.0"
},
"conflict": {
"contao-community-alliance/composer-plugin": "<3.0",
"contao/core": "*",
"contao/manager-plugin": "<2.0 || >=3.0",
"doctrine/doctrine-migrations-bundle": "<1.1",
"doctrine/orm": "<2.4",
"lexik/maintenance-bundle": "2.1.4",
"symfony/finder": "3.4.7 || 4.0.7",
"symfony/security": "3.4.7 || 3.4.8 || 3.4.11",
"symfony/swiftmailer-bundle": "2.6.* <2.6.2"
},
"provide": {
"replace": {
"contao/calendar-bundle": "self.version",
"contao/comments-bundle": "self.version",
"contao/core-bundle": "self.version",
Expand All @@ -103,9 +89,22 @@
"contao/news-bundle": "self.version",
"contao/newsletter-bundle": "self.version"
},
"conflict": {
"contao-community-alliance/composer-plugin": "<3.0",
"contao/core": "*",
"contao/manager-plugin": "<2.0 || >=3.0",
"doctrine/doctrine-migrations-bundle": "<1.1",
"doctrine/orm": "<2.4",
"lexik/maintenance-bundle": "2.1.4",
"symfony/finder": "3.4.7 || 4.0.7",
"symfony/http-kernel": "<4.1",
"symfony/monolog-bridge": "<4.1",
"symfony/swiftmailer-bundle": "2.6.* <2.6.2"
},
"require-dev": {
"ext-fileinfo": "*",
"composer/composer": "^1.0",
"contao/monorepo-tools": "dev-master",
"contao/test-case": "^1.3",
"doctrine/doctrine-migrations-bundle": "^1.1",
"doctrine/orm": "^2.5",
Expand All @@ -115,7 +114,6 @@
"oneup/phpstan-contao": "^0.2.1",
"php-coveralls/php-coveralls": "^2.1",
"php-http/message-factory": "^1.0.2",
"phpstan/phpstan": "^0.10.2",
"phpstan/phpstan-phpunit": "^0.10",
"phpunit/phpunit": "^7.0",
"symfony/phpunit-bridge": "^3.4.5"
Expand Down Expand Up @@ -161,12 +159,36 @@
"core-bundle/src/Resources/functions/utf8_bootup.php"
],
"exclude-from-classmap": [
"*/src/Resources/contao/config/",
"*/src/Resources/contao/dca/",
"*/src/Resources/contao/helper/",
"*/src/Resources/contao/languages/",
"*/src/Resources/contao/templates/",
"*/src/Resources/contao/themes/"
"calendar-bundle/src/Resources/contao/config/",
"calendar-bundle/src/Resources/contao/dca/",
"calendar-bundle/src/Resources/contao/languages/",
"calendar-bundle/src/Resources/contao/templates/",
"comments-bundle/src/Resources/contao/config/",
"comments-bundle/src/Resources/contao/dca/",
"comments-bundle/src/Resources/contao/languages/",
"comments-bundle/src/Resources/contao/templates/",
"core-bundle/src/Resources/contao/config/",
"core-bundle/src/Resources/contao/dca/",
"core-bundle/src/Resources/contao/helper/",
"core-bundle/src/Resources/contao/languages/",
"core-bundle/src/Resources/contao/templates/",
"core-bundle/src/Resources/contao/themes/",
"faq-bundle/src/Resources/contao/config/",
"faq-bundle/src/Resources/contao/dca/",
"faq-bundle/src/Resources/contao/languages/",
"faq-bundle/src/Resources/contao/templates/",
"listing-bundle/src/Resources/contao/config/",
"listing-bundle/src/Resources/contao/dca/",
"listing-bundle/src/Resources/contao/languages/",
"listing-bundle/src/Resources/contao/templates/",
"news-bundle/src/Resources/contao/config/",
"news-bundle/src/Resources/contao/dca/",
"news-bundle/src/Resources/contao/languages/",
"news-bundle/src/Resources/contao/templates/",
"newsletter-bundle/src/Resources/contao/config/",
"newsletter-bundle/src/Resources/contao/dca/",
"newsletter-bundle/src/Resources/contao/languages/",
"newsletter-bundle/src/Resources/contao/templates/"
]
},
"autoload-dev": {
Expand Down
2 changes: 2 additions & 0 deletions core-bundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
"doctrine/orm": "<2.4",
"lexik/maintenance-bundle": "2.1.4",
"symfony/finder": "3.4.7 || 4.0.7",
"symfony/http-kernel": "<4.1",
"symfony/monolog-bridge": "<4.1",
"symfony/swiftmailer-bundle": "2.6.* <2.6.2"
},
"require-dev": {
Expand Down

0 comments on commit ccab809

Please sign in to comment.