Make WordPress Core

Ticket #47767: 47767.17.diff

File 47767.17.diff, 9.0 KB (added by pento, 6 years ago)
  • .env

    diff --git a/.env b/.env
    index fda527930d..63ae0f1962 100644
    a b LOCAL_PHP=latest 
    1818# Whether or not to enable XDebug.
    1919LOCAL_PHP_XDEBUG=false
    2020
     21# Whether or not to enable Memcached.
     22LOCAL_PHP_MEMCACHED=false
     23
    2124# The MySQL version to use. See https://hub.docker.com/_/mysql/ for valid versions.
    2225LOCAL_MYSQL=5.7
    2326
  • .travis.yml

    diff --git a/.travis.yml b/.travis.yml
    index 15ed25bd35..4e083c87e9 100644
    a b cache: 
    1717
    1818env:
    1919  global:
    20     - LOCAL_DIR=build
     20    - LOCAL_DIR: build
    2121
    2222matrix:
    2323  include:
    2424  - env: WP_TRAVISCI=test:e2e
     25    name: E2E Tests
    2526  - env: WP_TRAVISCI=travis:phpcs
     27    name: PHP Linting
    2628  - env: WP_TRAVISCI=travis:js
     29    name: JS Tests
    2730  - env: LOCAL_PHP=7.3-fpm WP_TRAVISCI=test:php
    28   - php: 7.3
    29     dist: trusty
    30     env: WP_TRAVIS_OBJECT_CACHE=true WP_TRAVISCI=travis:phpunit
    31     services: memcached
     31    name: "PHPUnit Tests: PHP 7.3"
     32  - env: LOCAL_PHP=7.3-fpm LOCAL_PHP_MEMCACHED=true WP_TRAVISCI=test:php
     33    name: "PHPUnit Tests: PHP 7.3 with Memcached"
    3234  - env: LOCAL_PHP=7.2-fpm WP_TRAVISCI=test:php
     35    name: "PHPUnit Tests: PHP 7.2"
    3336  - env: LOCAL_PHP=7.1-fpm WP_TRAVISCI=test:php
     37    name: "PHPUnit Tests: PHP 7.1"
    3438  - env: LOCAL_PHP=7.0-fpm WP_TEST_REPORTER=true WP_TRAVISCI=test:php
     39    name: "PHPUnit Tests: PHP 7.0"
    3540  - env: LOCAL_PHP=5.6-fpm WP_TRAVISCI=test:php
    36   - php: 7.4snapshot
    37     dist: trusty
    38     env: WP_TRAVISCI=travis:phpunit
    39   - php: nightly
    40     dist: trusty
    41     env: WP_TRAVISCI=travis:phpunit
     41    name: "PHPUnit Tests: PHP 5.6"
     42  - env: LOCAL_PHP=7.4-fpm WP_TRAVISCI=test:php
     43    name: "PHPUnit Tests: PHP 7.4"
     44  - env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
     45    name: "PHPUnit Tests: PHP 8.0"
    4246  allow_failures:
    43   - php: 7.4snapshot
    44   - php: nightly
     47  - env: LOCAL_PHP=7.4-fpm WP_TRAVISCI=test:php
     48  - env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
    4549  fast_finish: true
    4650
    4751before_install:
    48 - |
    49   if [[ "$WP_TRAVISCI" == "travis:phpunit" ]]; then
    50       mysql -u root -e "CREATE DATABASE wordpress_tests;"
    51       cp wp-tests-config-sample.php wp-tests-config.php
    52       sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php
    53       sed -i "s/yourusernamehere/root/" wp-tests-config.php
    54       sed -i "s/yourpasswordhere//" wp-tests-config.php
    55       travis_retry svn checkout https://plugins.svn.wordpress.org/wordpress-importer/tags/0.6.3/ tests/phpunit/data/plugins/wordpress-importer
    56   fi
    5752- |
    5853  if [[ "$WP_TRAVISCI" == "test:php" ]]; then
    5954      cp wp-tests-config-sample.php wp-tests-config.php
    before_install: 
    6156      sed -i "s/yourusernamehere/root/" wp-tests-config.php
    6257      sed -i "s/yourpasswordhere/password/" wp-tests-config.php
    6358      sed -i "s/localhost/mysql/" wp-tests-config.php
     59      echo "define( 'FS_METHOD', 'direct' );" >> wp-tests-config.php
    6460      travis_retry svn checkout https://plugins.svn.wordpress.org/wordpress-importer/tags/0.6.3/ tests/phpunit/data/plugins/wordpress-importer
    6561  fi
    6662- |
    before_install: 
    6864  curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > docker-compose
    6965  chmod +x docker-compose
    7066  sudo mv docker-compose /usr/local/bin
    71 - |
    72   if [[ "$WP_TRAVIS_OBJECT_CACHE" == "true" ]]; then
    73     cp tests/phpunit/includes/object-cache.php src/wp-content/object-cache.php
    74     echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
    75   fi
    7667
    7768before_script:
    7869- |
    before_script: 
    10798  if [[ "$WP_TRAVISCI" == "test:e2e" ]] || [[ "$WP_TRAVISCI" == "test:php" ]]; then
    10899    npm run env:start
    109100    npm run build
     101    docker-compose -f tools/local-env/docker-compose.yml run --rm mysql mysql --version
     102    docker-compose -f tools/local-env/docker-compose.yml run --rm php php --version
     103    docker-compose -f tools/local-env/docker-compose.yml run --rm php php -m
     104    docker-compose -f tools/local-env/docker-compose.yml -f tools/local-env/docker-compose.scripts.yml run --rm phpunit phpunit --version
     105  fi
     106- |
     107  if [[ "$LOCAL_PHP_MEMCACHED" == "true" ]]; then
     108    cp tests/phpunit/includes/object-cache.php build/wp-content/object-cache.php
     109    docker run --name memcached --net local-env_wpdevnet -d memcached
    110110  fi
    111111- |
    112112  if [[ "$WP_TRAVISCI" == "test:e2e" ]]; then
    113113    npm run env:install
    114114  fi
    115 - mysql --version
    116 - phpenv versions
    117 - php --version
    118 - php -m
    119115- npm --version
    120116- node --version
    121 - which phpunit
    122 - phpunit --version
    123117- curl --version
    124118- git --version
    125119- svn --version
    script: 
    130124    if [[ "$WP_TRAVISCI" == "test:e2e" ]]; then
    131125      npm run test:e2e
    132126    elif [[ "$WP_TRAVISCI" == "test:php" ]]; then
    133       npm run test:php -- -- -- --verbose -c phpunit.xml.dist
    134       npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group ajax
    135       npm run test:php -- -- -- --verbose -c tests/phpunit/multisite.xml
    136       npm run test:php -- -- -- --verbose -c tests/phpunit/multisite.xml --group ms-files
    137       npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group external-http
     127      npm run test:php -- -- -- --verbose -c phpunit.xml.dist &&
     128      npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group ajax &&
     129      npm run test:php -- -- -- --verbose -c tests/phpunit/multisite.xml &&
     130      npm run test:php -- -- -- --verbose -c tests/phpunit/multisite.xml --group ms-files &&
     131      npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group external-http &&
    138132      npm run test:php -- -- -- --verbose -c phpunit.xml.dist --group restapi-jsclient
    139133    else
    140134      npm run grunt $WP_TRAVISCI
  • package.json

    diff --git a/package.json b/package.json
    index 023b269d48..8ab2c53cea 100644
    a b  
    147147                "env:cli": "dotenv npm run env:__cli-next",
    148148                "env:__cli-next": "docker-compose -f ./tools/local-env/docker-compose.yml -f ./tools/local-env/docker-compose.scripts.yml run --rm cli",
    149149                "env:logs": "docker-compose -f ./tools/local-env/docker-compose.yml -f ./tools/local-env/docker-compose.scripts.yml logs",
     150                "env:pull": "dotenv npm run env:__pull-next",
     151                "env:__pull-next": "docker-compose -f ./tools/local-env/docker-compose.yml -f ./tools/local-env/docker-compose.scripts.yml pull",
    150152                "test:e2e": "dotenv npm run test:__e2e-next",
    151153                "test:__e2e-next": "cross-var cross-env WP_BASE_URL=http://localhost:$LOCAL_PORT wp-scripts test-e2e --config tests/e2e/jest.config.js",
    152154                "test:php": "dotenv npm run test:__php-next",
  • tests/phpunit/includes/object-cache.php

    diff --git a/tests/phpunit/includes/object-cache.php b/tests/phpunit/includes/object-cache.php
    index 8fcc4f9261..c97ccb8d64 100644
    a b class WP_Object_Cache { 
    835835                if ( isset( $memcached_servers ) ) {
    836836                        $this->servers = $memcached_servers;
    837837                } else {
    838                         $this->servers = array( array( '127.0.0.1', 11211 ) );
     838                        $this->servers = array( array( 'memcached', 11211 ) );
    839839                }
    840840
    841841                $this->addServers( $this->servers );
  • tests/phpunit/tests/ajax/CustomizeMenus.php

    diff --git a/tests/phpunit/tests/ajax/CustomizeMenus.php b/tests/phpunit/tests/ajax/CustomizeMenus.php
    index bca0bdcc64..bb092cdad4 100644
    a b class Tests_Ajax_CustomizeMenus extends WP_Ajax_UnitTestCase { 
    5454
    5555                if ( 'administrator' !== $role ) {
    5656                        // If we're not an admin, we should get a wp_die(-1).
    57                         $this->setExpectedException( 'WPAjaxDieStopException' );
     57                        $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
    5858                }
    5959
    6060                wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) );
    class Tests_Ajax_CustomizeMenus extends WP_Ajax_UnitTestCase { 
    443443
    444444                if ( 'administrator' !== $role ) {
    445445                        // If we're not an admin, we should get a wp_die(-1).
    446                         $this->setExpectedException( 'WPAjaxDieStopException' );
     446                        $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
    447447                }
    448448
    449449                wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) );
  • tools/local-env/docker-compose.scripts.yml

    diff --git a/tools/local-env/docker-compose.scripts.yml b/tools/local-env/docker-compose.scripts.yml
    index 1f42a5261b..f5a5153545 100644
    a b services: 
    1313
    1414    environment:
    1515      LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
     16      LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
    1617
    1718    volumes:
    1819      - ../../:/var/www
    services: 
    3132
    3233    environment:
    3334      LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
     35      LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
    3436
    3537    volumes:
    3638      - ./phpunit-config.ini:/usr/local/etc/php/conf.d/phpunit-config.ini
  • tools/local-env/docker-compose.yml

    diff --git a/tools/local-env/docker-compose.yml b/tools/local-env/docker-compose.yml
    index 32021df1df..ddbec7fe47 100644
    a b services: 
    3838
    3939    environment:
    4040      LOCAL_PHP_XDEBUG: ${LOCAL_PHP_XDEBUG-false}
     41      LOCAL_PHP_MEMCACHED: ${LOCAL_PHP_MEMCACHED-false}
    4142
    4243    volumes:
    4344      - ./php-config.ini:/usr/local/etc/php/conf.d/php-config.ini