Skip to content

Instantly share code, notes, and snippets.

View Adroit11's full-sized avatar
🏠
Working from home

Ogundiji Bolade Adroit11

🏠
Working from home
View GitHub Profile
@Adroit11
Adroit11 / keybase.md
Last active September 12, 2019 11:28

Keybase proof

I hereby claim:

  • I am adroit11 on github.
  • I am adroitcode (https://keybase.io/adroitcode) on keybase.
  • I have a public key ASBVK682R9byaWZPATeGrUIieM7rmH-7qq4Oqq1Oj_875wo

To claim this, I am signing this object:

@Adroit11
Adroit11 / libraryTestCase.php
Last active January 19, 2019 20:27
libraryTestCase for DELETE
<?php
use Library\App\LibraryRoute;
use Slim\Http\Environment;
use Slim\Http\Request;
use PHPUnit\Framework\TestCase;
class LibraryTestCase extends TestCase
{
protected $app;
public function setUp()
@Adroit11
Adroit11 / libraryTestCase.php
Last active January 19, 2019 20:27
Updated with post request
<?php
use Library\App\LibraryRoute;
use Slim\Http\Environment;
use Slim\Http\Request;
use PHPUnit\Framework\TestCase;
class LibraryTestCase extends TestCase
{
protected $app;
public function setUp()
@Adroit11
Adroit11 / libraryTestCase.php
Created January 19, 2019 15:19
updated library testcase to get all libraries
<?php
use Library\App\LibraryRoute;
use Slim\Http\Environment;
use Slim\Http\Request;
use PHPUnit\Framework\TestCase;
class LibraryTestCase extends TestCase
{
protected $app;
public function setUp()
@Adroit11
Adroit11 / libraryTestCase.php
Last active January 19, 2019 15:17
updated libraryTestCase file
<?php
use Library\App\LibraryRoute;
use Slim\Http\Environment;
use Slim\Http\Request;
use PHPUnit\Framework\TestCase;
class LibraryTestCase extends TestCase
{
protected $app;
public function setUp()
@Adroit11
Adroit11 / index.php
Last active January 19, 2019 14:46
Updated index.php
<?php
require '../vendor/autoload.php';
// Run app
$app = (new Library\App\LibraryRoute())->get();
$app->run();
@Adroit11
Adroit11 / composer.json
Created January 19, 2019 14:42
updated for composer dump-autoload
{
"name": "your name",
"description":"a simple mini library demo app",
"require": {
"slim/slim": "^3.0"
},
"require-dev": {
"phpunit/phpunit": "^7"
},
"autoload": {
@Adroit11
Adroit11 / libraryRoute.php
Last active January 19, 2019 20:20
libraryRoute.php file
<?php
namespace Library\App;
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
class LibraryRoute
{
/**
* Stores an instance of the Slim application.
*
* @var \Slim\App
@Adroit11
Adroit11 / index.php
Last active January 19, 2019 14:15
updated inde.php file
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require '../vendor/autoload.php';
$app = new \Slim\App();
function availableLibraryId($id) {
return (int)$id && $id > 0 && $id <= 5;
@Adroit11
Adroit11 / LibraryTestCase.php
Created January 19, 2019 13:58
The test file
<?php
use PHPUnit\Framework\TestCase;
class LibraryTestCase extends TestCase
{
public function testLibraryGet() {
$this->assertTrue(true);
}
}