PHP code example of raphhh / pumpkin

1. Go to this page and download the library: Download raphhh/pumpkin 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/ */

    

raphhh / pumpkin example snippets


class FooTest extends Pumpkin\TestCase
{

    function testA(){
        $this->getTest()->getReflectedTestMethod()->getName(); //FooTest::testA
    }

    function testB(){
        $this->getTest()->getReflectedTestMethod()->getName(); //FooTest::testB
    }
}

//Mocks
// /fixtures/mocks/FooTest/testA.php

class Mock1{}

class mock2{}

// Test case

class FooTest extends Pumpkin\TestCase
{

    function testA(){
        $this->getMocks(); //returns [Mock1, Mock2]
    }

}

// Test case
use Pumpkin\Database\Annotation as db;

class FooTest extends Pumpkin\Database\TestCase
{

    /**
     * @db("my_database.my_table")
     * @db("my_other_database.my_other_table")
     */
    function testA(){
       //my_database.my_table and my_other_database.my_other_table data will be load when this test will be executed
    }

}

/fixtures/mocks/{ClassTestName}/{methodName}.php