PHP Index

Hello World

PHP comes with a built in server that helps to speed up developing by not having to configure a system web server, first create file index.php;

        <?php
           echo "Hello World";
        

Now run the server;

        $ php -S localhost:8000
        

Open your browser and browse http://localhost:8000, you should see "Hello World".

Profiling

Testing

Create folder tests for phpunit files with settings, inside create another called tests to create tests to be performed on the code.

        $ mkdir -p tests/tests
        $ cd tests
        

Create a test tests/EngineTest.php;

       <?php
        declare(strict_types=1);

        use PHPUnit\Framework\TestCase;

        final class EngineTest extends TestCase {

            public function testCanBeCreated(){

                   $engine = new engine();

                   $this->assertInstanceOf(engine::class, $engine);

            }
        }
       

Create phpunit.xml;

       $ phpunit --generate-configuration
       

Run the test;

       $ phpunit
       
PHP Index

This is part of the Hive System Documentation. Copyright (C) 2018 Hive Team. See the file Gnu Free Documentation License for copying conditions.