Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
prytoegrian committed Sep 22, 2018
2 parents a5fa0f9 + afc8424 commit 17b77a7
Show file tree
Hide file tree
Showing 24 changed files with 498 additions and 173 deletions.
2 changes: 1 addition & 1 deletion Absence/Type/TypeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ final protected function getEntite2Storage(AEntite $entite) : array
*/
final protected function setWhere(array $parametres)
{
if (!empty($parametres['id'])) {
if (array_key_exists('id', $parametres)) {
$this->queryBuilder->andWhere('ta_id = :id');
$this->queryBuilder->setParameter(':id', (int) $parametres['id']);
}
Expand Down
2 changes: 1 addition & 1 deletion Groupe/Employe/EmployeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function deleteOne(int $id) : int
*/
final protected function setWhere(array $parametres)
{
if (!empty($parametres['id'])) {
if (array_key_exists('id', $parametres)) {
$this->queryBuilder->andWhere('gu_gid = :id');
$this->queryBuilder->setParameter(':id', (int) $parametres['id']);
}
Expand Down
2 changes: 1 addition & 1 deletion Groupe/GrandResponsable/GrandResponsableRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function deleteOne(int $id) : int
*/
final protected function setWhere(array $parametres)
{
if (!empty($parametres['id'])) {
if (array_key_exists('id', $parametres)) {
$this->queryBuilder->andWhere('ggr_gid = :id');
$this->queryBuilder->setParameter(':id', (int) $parametres['id']);
}
Expand Down
2 changes: 1 addition & 1 deletion Groupe/GroupeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ final protected function setSet(array $parametres)
*/
final protected function setWhere(array $parametres)
{
if (!empty($parametres['id'])) {
if (array_key_exists('id', $parametres)) {
$this->queryBuilder->andWhere('g_gid = :id');
$this->queryBuilder->setParameter(':id', (int) $parametres['id']);
}
Expand Down
2 changes: 1 addition & 1 deletion Groupe/Responsable/ResponsableRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function deleteOne(int $id) : int
*/
final protected function setWhere(array $parametres)
{
if (!empty($parametres['id'])) {
if (array_key_exists('id', $parametres)) {
$this->queryBuilder->andWhere('g_gid = :id');
$this->queryBuilder->setParameter(':id', (int) $parametres['id']);
}
Expand Down
2 changes: 1 addition & 1 deletion Journal/JournalRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function deleteOne(int $id) : int
*/
final protected function setWhere(array $parametres)
{
if (!empty($parametres['id'])) {
if (array_key_exists('id', $parametres)) {
$this->queryBuilder->andWhere('log_id = :id');
$this->queryBuilder->setParameter(':id', (int) $parametres['id']);
}
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ minor:

patch:
$(call make_version,patch)

test:
Vendor/Bin/atoum -ulr
6 changes: 3 additions & 3 deletions Planning/Creneau/CreneauRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final protected function getEntiteClass() : string
final protected function getParamsConsumer2Storage(array $paramsConsumer) : array
{
$results = [];
if (!empty($paramsConsumer['planningId'])) {
if (array_key_exists('planningId', $paramsConsumer)) {
$results['planning_id'] = (int) $paramsConsumer['planningId'];
}

Expand Down Expand Up @@ -144,11 +144,11 @@ final protected function setSet(array $parametres)
*/
final protected function setWhere(array $parametres)
{
if (!empty($parametres['id'])) {
if (array_key_exists('id', $parametres)) {
$this->queryBuilder->andWhere('creneau_id = :id');
$this->queryBuilder->setParameter(':id', (int) $parametres['id']);
}
if (!empty($parametres['planning_id'])) {
if (array_key_exists('planning_id', $parametres)) {
$this->queryBuilder->andWhere('planning_id = :planningId');
$this->queryBuilder->setParameter(':planningId', (int) $parametres['planning_id']);
}
Expand Down
2 changes: 1 addition & 1 deletion Planning/PlanningRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ final protected function setSet(array $parametres)
*/
final protected function setWhere(array $parametres)
{
if (!empty($parametres['id'])) {
if (array_key_exists('id', $parametres)) {
$this->queryBuilder->andWhere('planning_id = :id');
$this->queryBuilder->setParameter(':id', $parametres['id']);
}
Expand Down
11 changes: 11 additions & 0 deletions Public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@
$containerBuilder->addDefinitions(ROOT_PATH . 'di-config.php');
$app = new \Slim\App($containerBuilder->build());

/*
* Commençons simple et posons le paramétrage des assert ici.
* Précision : une partie est faite côté php.ini (nouvelle norme)
*/
if ('development' == $app->getContainer()->get('environment')->get('stage')) {
ini_set('assert.exception', '1');
} else {
assert_options(ASSERT_ACTIVE, 0);
ini_set('assert.exception', '0');
}

/*
* /!\ Les Middlewares sont executés en mode PILE : le premier de la liste est lancé en dernier
*/
Expand Down
122 changes: 0 additions & 122 deletions Tests/Units/Tools/Controllers/AuthentificationController.php

This file was deleted.

8 changes: 0 additions & 8 deletions Tests/Units/Tools/Libraries/ARestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ abstract class ARestController extends AController
*/
protected $currentAdmin;

/**
* Init des tests
*/
public function beforeTestMethod($method)
{
parent::beforeTestMethod($method);
}

/*************************************************
* GET
*************************************************/
Expand Down
64 changes: 64 additions & 0 deletions Tests/Units/Tools/Services/AAuthentifierFactoryService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php declare(strict_types = 1);
namespace LibertAPI\Tests\Units\Tools\Services;

use LibertAPI\Tools\Services;

/**
* Classe de test de la fabrique de services d'authentification
*
* @author Prytoegrian <prytoegrian@protonmail.com>
* @author Wouldsmina
*
* @since 1.1
*/
class AAuthentifierFactoryService extends \Atoum
{
public function beforeTestMethod($method)
{
parent::beforeTestMethod($method);

$this->mockGenerator->orphanize('__construct');
$this->mockGenerator->shuntParentClassCalls();
$this->configuration = new \mock\LibertAPI\Tools\Libraries\StorageConfiguration();
$this->mockGenerator->orphanize('__construct');
$this->repository = new \mock\LibertAPI\Tools\Libraries\ARepository();
}

public function testGetLdapService()
{
$this->calling($this->configuration)->getHowToConnectUser = 'ldap';

$testedClass = $this->testedClass->getClass();
$service = $testedClass::getAuthentifier($this->configuration, $this->repository);
$this->object($service)->isInstanceOf(Services\LdapAuthentifierService::class);
}

public function testGetInterneService()
{
$this->calling($this->configuration)->getHowToConnectUser = 'dbconges';

$testedClass = $this->testedClass->getClass();
$service = $testedClass::getAuthentifier($this->configuration, $this->repository);
$this->object($service)->isInstanceOf(Services\InterneAuthentifierService::class);
}

public function testGetUnknownService()
{
$this->calling($this->configuration)->getHowToConnectUser = 'foobar';

$this->exception(function () {
$testedClass = $this->testedClass->getClass();
$testedClass::getAuthentifier($this->configuration, $this->repository);
})->isInstanceOf(\UnexpectedValueException::class);
}

/**
* @var LibertAPI\Tools\Libraries\StorageConfiguration Mock de la configuration
*/
private $configuration;

/**
* @var LibertAPI\Tools\Libraries\ARepository Mock d'un repository lambda
*/
private $repository;
}
Loading

0 comments on commit 17b77a7

Please sign in to comment.