Commit 3fd0d8bd authored by MikeyMJCO's avatar MikeyMJCO

Fix tests and 4.1.x deprecations

parent 3d6e7b3e
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -20,8 +20,7 @@ class AppKernel extends Kernel { ...@@ -20,8 +20,7 @@ class AppKernel extends Kernel {
if (in_array($this->getEnvironment(), ['dev', 'test'], TRUE)) { if (in_array($this->getEnvironment(), ['dev', 'test'], TRUE)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); $bundles[] = new Symfony\Bundle\MakerBundle\MakerBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
} }
if ('dev' === $this->getEnvironment()) { if ('dev' === $this->getEnvironment()) {
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -25,7 +25,7 @@ server { ...@@ -25,7 +25,7 @@ server {
} }
location ~ ^/app_dev\.php(/|$) { location ~ ^/app_dev\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params; include fastcgi_params;
# When you are using symlinks to link the document root to the # When you are using symlinks to link the document root to the
...@@ -61,15 +61,3 @@ server { ...@@ -61,15 +61,3 @@ server {
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
} }
server {
if ($host = v2018.docs.civicrm.dev.mjco.uk) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name v2018.docs.civicrm.dev.mjco.uk;
listen 80;
return 404; # managed by Certbot
}
server {
server_name localhost;
listen *:8080;
root /var/www/web;
# For a development configuration, change "app" to "app_dev" everywhere
# below. Then you'll see the Symfony web debug toolbar when viewing pages.
# Requests for static book files
# - Book slug can't begin with underscore
# - Book slug can't be "admin"
# - Must begin with three distinct path pieces, separated by forward slashes
location ~ ^/(?!_)(?!admin/)[^/]+/[^/]+/[^/]+ {
# - Use a trailing slash for the $uri to treat paths like directories
# - Then, try to find directories that match our request.
# - If we can't find anything, we send the request to the app and let
# it deal with the rest.
try_files $uri/ $uri /app_dev.php$is_args$args;
}
# requests for Symfony app functionality
location / {
# - Don't use a trailing slash for $uri here. This line is straight from
# the Symfony recommended nginx settings
try_files $uri /app_dev.php$is_args$args;
}
location ~ ^/app_dev\.php(/|$) {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/app.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}
#error_log /var/log/nginx/civicrm-docs-error.log;
#access_log /var/log/nginx/civicrm-docs-access.log;
}
...@@ -23,7 +23,7 @@ framework: ...@@ -23,7 +23,7 @@ framework:
engines: ['twig'] engines: ['twig']
default_locale: "%locale%" default_locale: "%locale%"
trusted_hosts: ~ trusted_hosts: ~
trusted_proxies: ~ #trusted_proxies: ~ # Deprecated v3.3
session: session:
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id # http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file handler_id: session.handler.native_file
...@@ -66,3 +66,8 @@ swiftmailer: ...@@ -66,3 +66,8 @@ swiftmailer:
username: "%mailer_user%" username: "%mailer_user%"
password: "%mailer_password%" password: "%mailer_password%"
spool: { type: memory } spool: { type: memory }
# Sensio Framework Configuration
sensio_framework_extra:
router:
annotations: false
...@@ -17,10 +17,10 @@ monolog: ...@@ -17,10 +17,10 @@ monolog:
type: stream type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log" path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug level: debug
channels: [!event] channels: ["!event"]
console: console:
type: console type: console
channels: [!event, !doctrine] channels: ["!event", "!doctrine"]
# uncomment to get logging in your browser # uncomment to get logging in your browser
# you may have to allow bigger header sizes in your Web server configuration # you may have to allow bigger header sizes in your Web server configuration
#firephp: #firephp:
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
# Learn more about services, parameters and containers at # Learn more about services, parameters and containers at
# http://symfony.com/doc/current/book/service_container.html # http://symfony.com/doc/current/book/service_container.html
parameters: parameters:
books_dir: %kernel.root_dir%/../books books_dir: "%kernel.root_dir%/../books"
services: services:
_defaults:
autowire: true
autoconfigure: true
library: library:
class: AppBundle\Model\Library class: AppBundle\Model\Library
arguments: arguments:
- %books_dir% - "%books_dir%"
public: true
webhook.processor: webhook.processor:
class: AppBundle\Utils\WebhookProcessor class: AppBundle\Utils\WebhookProcessor
...@@ -16,12 +20,15 @@ services: ...@@ -16,12 +20,15 @@ services:
- -
- '@github.webhook_handler' - '@github.webhook_handler'
- '@gitlab.webbook_handler' - '@gitlab.webbook_handler'
public: true
github.webhook_handler: github.webhook_handler:
class: AppBundle\Utils\WebhookAdapters\GithubHandler class: AppBundle\Utils\WebhookAdapters\GithubHandler
public: true
gitlab.webbook_handler: gitlab.webbook_handler:
class: AppBundle\Utils\WebhookAdapters\GitlabHandler class: AppBundle\Utils\WebhookAdapters\GitlabHandler
public: true
mkdocs: mkdocs:
class: AppBundle\Utils\MkDocs class: AppBundle\Utils\MkDocs
...@@ -38,6 +45,7 @@ services: ...@@ -38,6 +45,7 @@ services:
- '@mkdocs' - '@mkdocs'
- '@git' - '@git'
- '@paths' - '@paths'
public: true
filesystem: filesystem:
class: AppBundle\Utils\FileSystem class: AppBundle\Utils\FileSystem
...@@ -45,8 +53,8 @@ services: ...@@ -45,8 +53,8 @@ services:
paths: paths:
class: AppBundle\Utils\Paths class: AppBundle\Utils\Paths
arguments: arguments:
- '%kernel.root_dir%' - "%kernel.root_dir%"
- '%kernel.cache_dir%' - "%kernel.cache_dir%"
git: git:
class: AppBundle\Utils\GitTools class: AppBundle\Utils\GitTools
...@@ -66,7 +74,7 @@ services: ...@@ -66,7 +74,7 @@ services:
streamhandler: streamhandler:
class: Monolog\Handler\StreamHandler class: Monolog\Handler\StreamHandler
arguments: arguments:
- %kernel.logs_dir%/publish.log - "%kernel.logs_dir%/publish.log"
app.exception_listener: app.exception_listener:
class: AppBundle\EventListener\ExceptionListener class: AppBundle\EventListener\ExceptionListener
......
#!/bin/bash #!/bin/bash
find web/static var -exec setfacl -m u:www-data:rwx {} \; find web/static var -exec setfacl -m u:www-data:rwx {} \;
find web/static var -exec setfacl -m u:docs:rwx {} \; find web/static var -exec setfacl -m u:mjco:rwx {} \;
find web/static var -exec setfacl -x u:co {} \; #find web/static var -exec setfacl -x u:co {} \;
find web/static var -type d -exec setfacl -m d:u:www-data:rwx {} \; find web/static var -type d -exec setfacl -m d:u:www-data:rwx {} \;
find web/static var -type d -exec setfacl -m d:u:docs:rwx {} \; find web/static var -type d -exec setfacl -m d:u:mjco:rwx {} \;
find web/static var -type d -exec setfacl -x d:u:co {} \; #find web/static var -type d -exec setfacl -x d:u:co {} \;
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -6,17 +6,17 @@ langs: ...@@ -6,17 +6,17 @@ langs:
en: en:
repo: 'https://github.com/civicrm/civicrm-user-guide' repo: 'https://github.com/civicrm/civicrm-user-guide'
versions: versions:
5: # This is stored as $slug "5": # This is stored as $slug
name: 5 / Latest # If omitted, use $slug name: "5 / Latest" # If omitted, use $slug
path: latest # If omitted, use a URL-safe version of $slug path: latest # If omitted, use a URL-safe version of $slug
branch: master # If omitted, use $slug branch: master # If omitted, use $slug
redirects: # These are not displayed anywhere redirects: # These are not displayed anywhere
- current - current
- stable - stable
- 4.7 - "4.7"
4.6: "4.6":
branch: 4.6 branch: "4.6"
name: 4.6 / Long Term Support name: "4.6 / Long Term Support"
redirects: redirects:
- lts - lts
ca: ca:
......
File mode changed from 100644 to 100755
...@@ -18,39 +18,28 @@ ...@@ -18,39 +18,28 @@
}, },
"require": { "require": {
"php": "^7.0", "php": "^7.0",
"symfony/symfony": "^3.0", "symfony/symfony": "^4.1",
"doctrine/orm": "^2.5", "doctrine/orm": "^2.5",
"twig/twig": "^1.33", "twig/twig": "^2.5",
"doctrine/doctrine-bundle": "^1.6", "doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2", "doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3", "symfony/swiftmailer-bundle": "^3.2",
"symfony/monolog-bundle": "^2.8", "symfony/monolog-bundle": "^3.3",
"sensio/distribution-bundle": "^5.0", "sensio/framework-extra-bundle": "^5.2",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0", "incenteev/composer-parameter-handler": "^2.0",
"symfony/web-server-bundle": "^3.3" "phpunit/phpunit": "^7.4"
}, },
"require-dev": { "require-dev": {
"sensio/generator-bundle": "^3.0", "symfony/maker-bundle": "^1.7",
"symfony/phpunit-bridge": "^3.0", "symfony/phpunit-bridge": "^4.1",
"phpunit/phpunit": "^5.7" "symfony/web-server-bundle": "^4.1"
}, },
"scripts": { "scripts": {
"post-install-cmd": [ "post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
], ],
"post-update-cmd": [ "post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
] ]
}, },
"extra": { "extra": {
......
This diff is collapsed.
...@@ -10,10 +10,11 @@ ...@@ -10,10 +10,11 @@
<php> <php>
<ini name="error_reporting" value="-1" /> <ini name="error_reporting" value="-1" />
<server name="KERNEL_DIR" value="app/" /> <server name="KERNEL_DIR" value="app/" />
<env name="KERNEL_CLASS" value="AppKernel" />
</php> </php>
<testsuites> <testsuites>
<testsuite name="Project Test Suite"> <testsuite name="CiviCRM Docs Publisher Test Suite">
<directory>tests</directory> <directory>tests</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -7,7 +7,7 @@ use AppBundle\Utils\Publisher; ...@@ -7,7 +7,7 @@ use AppBundle\Utils\Publisher;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\Routing\Annotation\Route;
use AppBundle\Model\Library; use AppBundle\Model\Library;
...@@ -115,8 +115,7 @@ class PublishController extends Controller { ...@@ -115,8 +115,7 @@ class PublishController extends Controller {
'commits' => $commits, 'commits' => $commits,
]; ];
$body = $this->renderView('AppBundle:Emails:notify.html.twig', $renderParams); $body = $this->renderView('AppBundle:Emails:notify.html.twig', $renderParams);
$mail = \Swift_Message::newInstance() $mail = (new \Swift_Message($subject))
->setSubject($subject)
->setFrom('no-reply@civicrm.org', "CiviCRM docs") ->setFrom('no-reply@civicrm.org', "CiviCRM docs")
->setTo($recipients) ->setTo($recipients)
->setBody($body, 'text/html'); ->setBody($body, 'text/html');
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace AppBundle\Controller; namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\Routing\Annotation\Route;
class ReadController extends Controller { class ReadController extends Controller {
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -4,7 +4,7 @@ namespace AppBundle\Model; ...@@ -4,7 +4,7 @@ namespace AppBundle\Model;
use AppBundle\Utils\LocaleTools; use AppBundle\Utils\LocaleTools;
class Language { class Language implements \Countable {
/** /**
* @var string * @var string
...@@ -33,6 +33,14 @@ class Language { ...@@ -33,6 +33,14 @@ class Language {
*/ */
public $watchers = array(); public $watchers = array();
/**
* Implement a count() method.
*/
public function count() {
if (is_array($this->versions)) {
return count($this->versions);
}
}
/** /**
* Initialize a language with values in it. * Initialize a language with values in it.
* *
...@@ -71,7 +79,7 @@ class Language { ...@@ -71,7 +79,7 @@ class Language {
} }
// If no versions were defined, then add one version (with default values) // If no versions were defined, then add one version (with default values)
if (count($this->versions) == 0) { if (empty($this->versions)) {
$this->versions[] = new Version('latest', 'Latest', 'latest', 'master', ['stable', 'current']); $this->versions[] = new Version('latest', 'Latest', 'latest', 'master', ['stable', 'current']);
} }
} }
...@@ -173,7 +181,7 @@ class Language { ...@@ -173,7 +181,7 @@ class Language {
* @return bool * @return bool
*/ */
public function isMultiVersion() { public function isMultiVersion() {
return count($this->versions) > 1; return $this->count() > 1;
} }
/** /**
...@@ -182,7 +190,7 @@ class Language { ...@@ -182,7 +190,7 @@ class Language {
* @return integer * @return integer
*/ */
public function countVersions() { public function countVersions() {
return count($this->versions); return $this->count();
} }
/** /**
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace AppBundle\Model; namespace AppBundle\Model;
class LibraryTest extends \PHPUnit_Framework_TestCase { class LibraryTest extends \PHPUnit\Framework\TestCase {
/** /**
* @param string $identifier * @param string $identifier
......
...@@ -4,7 +4,7 @@ namespace AppBundle\Tests\Utils; ...@@ -4,7 +4,7 @@ namespace AppBundle\Tests\Utils;
use AppBundle\Utils\LocaleTools; use AppBundle\Utils\LocaleTools;
class LocaleToolsTest extends \PHPUnit_Framework_TestCase { class LocaleToolsTest extends \PHPUnit\Framework\TestCase {
/** /**
* @param string $languageCode * @param string $languageCode
......
...@@ -4,7 +4,7 @@ namespace AppBundle\Tests\Utils; ...@@ -4,7 +4,7 @@ namespace AppBundle\Tests\Utils;
use AppBundle\Utils\StringTools; use AppBundle\Utils\StringTools;
class StringToolsTest extends \PHPUnit_Framework_TestCase class StringToolsTest extends \PHPUnit\Framework\TestCase
{ {
/** /**
* @param string $string * @param string $string
......
...@@ -7,7 +7,7 @@ use AppBundle\Utils\WebhookAdapters\GitlabHandler; ...@@ -7,7 +7,7 @@ use AppBundle\Utils\WebhookAdapters\GitlabHandler;
use AppBundle\Utils\WebhookProcessor; use AppBundle\Utils\WebhookProcessor;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
class WebhookProcessorTest extends \PHPUnit_Framework_TestCase { class WebhookProcessorTest extends \PHPUnit\Framework\TestCase {
/** /**
* @param string $source * @param string $source
......
...@@ -389,7 +389,7 @@ class SymfonyRequirements extends RequirementCollection ...@@ -389,7 +389,7 @@ class SymfonyRequirements extends RequirementCollection
{ {
/* mandatory requirements follow */ /* mandatory requirements follow */
$installedPhpVersion = phpversion(); $installedPhpVersion = PHP_VERSION;
$requiredPhpVersion = $this->getPhpRequiredVersion(); $requiredPhpVersion = $this->getPhpRequiredVersion();
$this->addRecommendation( $this->addRecommendation(
...@@ -448,15 +448,8 @@ class SymfonyRequirements extends RequirementCollection ...@@ -448,15 +448,8 @@ class SymfonyRequirements extends RequirementCollection
} }
if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) { if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
$timezones = array();
foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
foreach ($abbreviations as $abbreviation) {
$timezones[$abbreviation['timezone_id']] = true;
}
}
$this->addRequirement( $this->addRequirement(
isset($timezones[@date_default_timezone_get()]), in_array(@date_default_timezone_get(), DateTimeZone::listIdentifiers(), true),
sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()), sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()),
'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.' 'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
); );
...@@ -731,7 +724,7 @@ class SymfonyRequirements extends RequirementCollection ...@@ -731,7 +724,7 @@ class SymfonyRequirements extends RequirementCollection
'Install and/or enable a <strong>PHP accelerator</strong> (highly recommended).' 'Install and/or enable a <strong>PHP accelerator</strong> (highly recommended).'
); );
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
$this->addRecommendation( $this->addRecommendation(
$this->getRealpathCacheSize() >= 5 * 1024 * 1024, $this->getRealpathCacheSize() >= 5 *