Make WordPress Core

Changeset 760 in tests


Ignore:
Timestamp:
06/30/2012 05:30:59 PM (13 years ago)
Author:
maxcutler
Message:

Initial port of nikolayb's phpunit-based framework.

See #42.

Location:
trunk
Files:
10 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/README.txt

    r751 r760  
    773. $ svn up
    88
    9 4. $ php wp-test.php
     94. $ phpunit path/to/test_case.php
    1010
    1111Notes:
    1212
    13 Test cases live in the 'wp-testcase' subdirectory.  All files in that directory will be included by default.  Extend the WPTestCase class to ensure your test is run.
     13Test cases live in the 'wp-testcase' subdirectory.  All files in that directory will be included by default.  Extend the WP_UnitTestCase class to ensure your test is run.
    1414
    15 wp-test.php will initialize and install a (more or less) complete running copy of WordPress each time it is run.  This makes it possible to run functional interface and module tests against a fully working database and codebase, as opposed to pure unit tests with mock objects and stubs.  Pure unit tests may be used also, of course.
     15phpunit will initialize and install a (more or less) complete running copy of WordPress each time it is run.  This makes it possible to run functional interface and module tests against a fully working database and codebase, as opposed to pure unit tests with mock objects and stubs.  Pure unit tests may be used also, of course.
    1616
    1717The test database will be wiped clean with DROP TABLE statements once tests are finished, to ensure a clean start next time the tests are run.
    1818
    19 wp-test.php is intended to run at the command line, not via a web server.
     19phpunit is intended to run at the command line, not via a web server.
  • trunk/wp-config-sample.php

    r751 r760  
    11<?php
     2
     3/* Path to the WordPress codebase you'd like to test. Add a backslash in the end. */
     4define( 'ABSPATH', dirname( __FILE__ ) . '/wordpress/' );
     5
    26// ** MySQL settings ** //
    37
     
    913// DO NOT use a production database or one that is shared with something else.
    1014
    11 define('DB_NAME', 'putyourdbnamehere');    // The name of the database
    12 define('DB_USER', 'usernamehere');     // Your MySQL username
    13 define('DB_PASSWORD', 'yourpasswordhere'); // ...and password
    14 define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
    15 define('DB_CHARSET', 'utf8');
    16 define('DB_COLLATE', '');
     15define( 'DB_NAME', 'putyourdbnamehere' );    // The name of the database
     16define( 'DB_USER', 'usernamehere' );     // Your MySQL username
     17define( 'DB_PASSWORD', 'yourpasswordhere' ); // ...and password
     18define( 'DB_HOST', 'localhost' );    // 99% chance you won't need to change this value
     19define( 'DB_CHARSET', 'utf8' );
     20define( 'DB_COLLATE', '' );
    1721
    1822// You can have multiple installations in one database if you give each a unique prefix
     
    2327// For example, install de.mo to wp-content/languages and set WPLANG to 'de'
    2428// to enable German language support.
    25 define ('WPLANG', '');
     29define ( 'WPLANG', '' );
    2630
    27 // uncomment and change this if you'd like to load plugins from a particular directory prior to testing
    28 #define('DIR_TESTPLUGINS', './wp-plugins');
    29 ?>
     31define( 'WP_TESTS_DOMAIN', 'example.org' );
     32define( 'WP_TESTS_EMAIL', 'admin@example.org' );
     33define( 'WP_TESTS_TITLE', 'Test Blog' );
     34define( 'WP_TESTS_NETWORK_TITLE', 'Test Network' );
     35define( 'WP_TESTS_SUBDOMAIN_INSTALL', true );
     36$base = '/';
     37
     38/* Cron tries to make an HTTP request to the blog, which always fails, because tests are run in CLI mode only */
     39define( 'DISABLE_WP_CRON', true );
     40
     41define( 'WP_ALLOW_MULTISITE', false );
     42if ( WP_ALLOW_MULTISITE ) {
     43    define( 'WP_TESTS_BLOGS', 'first,second,third,fourth' );
     44}
     45if ( WP_ALLOW_MULTISITE && ! defined('WP_INSTALLING') ) {
     46    define( 'SUBDOMAIN_INSTALL', WP_TESTS_SUBDOMAIN_INSTALL );
     47    define( 'MULTISITE', true );
     48    define( 'DOMAIN_CURRENT_SITE', WP_TESTS_DOMAIN );
     49    define( 'PATH_CURRENT_SITE', '/' );
     50    define( 'SITE_ID_CURRENT_SITE', 1 );
     51    define( 'BLOG_ID_CURRENT_SITE', 1 );
     52    //define( 'SUNRISE', TRUE );
     53}
     54
     55$table_prefix  = 'wp_';
     56
     57define( 'WP_PHP_BINARY', 'php' );
Note: See TracChangeset for help on using the changeset viewer.