PHP code example of open-function-computers-llc / better-wordpress

1. Go to this page and download the library: Download open-function-computers-llc/better-wordpress library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

open-function-computers-llc / better-wordpress example snippets


define( 'DB_NAME', 'rad_tdd_tests' );
define( 'DB_USER', 'root' );
define( 'DB_PASSWORD', 'your_password' );
define( 'DB_HOST', 'localhost' );

define( 'ABSPATH', '/path/to/wordpress/' );



namespace ofc\tests;

use ofc\Site;
use WP_UnitTestCase;

class MyFeatureTest extends WP_UnitTestCase
{
    protected function tearDown(): void
    {
        parent::tearDown();
        $reflection = new \ReflectionClass(Site::class);
        $instance = $reflection->getProperty('instance');
        $instance->setAccessible(true);
        $instance->setValue(null, null);
    }

    /** @test */
    public function myFeatureWorkAsExpected()
    {
        Site::getInstance([
            "handlebars" => false,
            // your config here
        ]);

        // your assertions here
    }
}

composer create-project open-function-computers-llc/wp-theme <theme-name>
bash
php -S localhost:8080