PHP code example of brunty / kahlan-pdo

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

    

brunty / kahlan-pdo example snippets


\Kahlan\box('db.path', __DIR__ . '/spec/db');
\Kahlan\box('db.path.sql', __DIR__ . '/spec/db/sql');



use function Brunty\Kahlan\PDO\reset;
use function Brunty\Kahlan\PDO\fixture;
use function Brunty\Kahlan\PDO\db;

describe('SqliteThingRepository', function() {

    beforeEach(function() {
        reset(); // reset our database before each test
    });

    it('gets all things from the database', function() {
        fixture('things'); // load fixtures inside this test

        // do stuff
        $stmt = db()->query('SELECT * FROM Things');
        $things = $stmt->fetchAll();
        // run assertions
    });
});



\Brunty\Kahlan\PDO\sql('things');