Commit ba7e79a4 authored by Henri-Damien LAURENT's avatar Henri-Damien LAURENT
Browse files

clean unused action

parent 3eec9dbf
Pipeline #10286 passed with stage
in 52 seconds
......@@ -2,7 +2,6 @@ test:php7_latest:
image: php:7
script:
- apt update -yqq && apt install git zip -yqq
- curl https://getcomposer.org/composer-stable.phar > composer.phar
- git submodule init
- git submodule update
- ./vendor/bin/phpunit -c tests/phpunit.xml
......
......@@ -21,18 +21,19 @@
namespace Pellicule;
use \Slim\Factory\AppFactory as SlimAppFactory;
use Fig\Http\Message\StatusCodeInterface;
use \Slim\Psr7\Response;
use \Fig\Http\Message\StatusCodeInterface;
class AppFactory {
public static function create() {
$app = SlimAppFactory::create();
$app->get('/', Controllers\Index::class);
$app->get('/1.0/media/isbn/{isbn}', Controllers\Media::class);
$app->get('/1.0/media/ean/{ean}', Controllers\Media::class);
$app->get('/1.0/media/ark:/{naan}/{name}', Controllers\Media::class);
$app->get('/1.0/media/{action}', function($request, $response, $args)
{
return new \Slim\Psr7\Response(StatusCodeInterface::STATUS_NOT_IMPLEMENTED);
return new Response(StatusCodeInterface::STATUS_NOT_IMPLEMENTED);
});
return $app;
......
<?php
namespace Pellicule\Controllers;
class Index {
public function __invoke($request, $response, $args) {
$response->getBody()->write("<h1>Pellicule</h1><p>Media agregator</p>");
$response->getBody()->write("{'records';[");
foreach(\Pellicule\Models\Record::findAll() as $record) {
$response->getBody()->write(json_encode('{\'isbn\':'.$record->getIsbn().'}') . ',');
}
$response->getBody()->write("]");
return $response;
}
}
\ No newline at end of file
<?php
namespace Pellicule\Tests;
use \Pellicule\AppFactory;
use \Pellicule\Models\Record;
class IndexTest extends TestCase {
/** @test */
public function h1ShouldContainsPellicule() {
$this->assertContains("Pellicule",
$this->httpGet('/'));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment