Skip to content

Commit

Permalink
Merge pull request #216 from GeOsmFamily:dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
BorisGautier authored Jan 2, 2024
2 parents 16f3ace + 0f0cd7e commit c0da2df
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 52 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,3 @@ jobs:
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: vendor/bin/phpunit
1 change: 1 addition & 0 deletions .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"defects":{"Tests\\Feature\\ExampleTest::test_example":7},"times":{"Tests\\Unit\\ExampleTest::test_example":0.01,"Tests\\Feature\\ExampleTest::test_example":0.055}}
23 changes: 7 additions & 16 deletions app/Http/Controllers/Api/OscController.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,30 +347,21 @@ public function searchOsc(Request $request)
* @urlParam q string required the query search. Example: ONG
* @responseFile storage/responses/getoscs.json
*/
public function searchOscByQuery(Request $request)
{
$q = $request->input('q');
$oscs = OSC::search($q)->where('active', 1)->get();

$filteredOscs = [];
public function searchOscByQuery(Request $request)
{
$q = $request->input('q');
$oscs = OSC::search($q)->get();

foreach ($oscs as $osc) {
// Ajoutez une condition pour vérifier si l'OSC est active
if ($osc->active == 1) {
foreach ($oscs as $osc) {
$osc->user;

foreach ($osc->categorieOdds as $categorieOdd) {
$categorieOdd->odd;
}

$osc->zoneInterventions;

$filteredOscs[] = $osc;
}
}

return $this->sendResponse($filteredOscs, 'Active OSC retrieved successfully.');
}
return $this->sendResponse($oscs, 'OSC retrieved successfully.');
}


/**
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/VerificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function verify($id, Request $request)
$user->markEmailAsVerified();
}
$success['user'] = $user;
return $this->sendResponse($success, 'Vérification Reussie');
return $this->sendResponse("", 'Verification Reussie');
}

/**
Expand All @@ -41,6 +41,6 @@ public function resend()

Auth::user()->sendEmailVerificationNotification();
$success['user'] = auth()->user();
return $this->sendResponse($success, 'Email verification link sent on your email id');
return $this->sendResponse("", 'Email verification link sent on your email id');
}
}
55 changes: 26 additions & 29 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
<php>
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<!-- <server name="DB_CONNECTION" value="sqlite"/> -->
<!-- <server name="DB_DATABASE" value=":memory:"/> -->
<server name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/>
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<coverage/>
<php>
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<!-- <server name="DB_CONNECTION" value="sqlite"/> -->
<!-- <server name="DB_DATABASE" value=":memory:"/> -->
<server name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/>
</php>
<source>
<include>
<directory suffix=".php">./app</directory>
</include>
</source>
</phpunit>
31 changes: 31 additions & 0 deletions phpunit.xml.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
<php>
<server name="APP_ENV" value="testing"/>
<server name="BCRYPT_ROUNDS" value="4"/>
<server name="CACHE_DRIVER" value="array"/>
<!-- <server name="DB_CONNECTION" value="sqlite"/> -->
<!-- <server name="DB_DATABASE" value=":memory:"/> -->
<server name="MAIL_MAILER" value="array"/>
<server name="QUEUE_CONNECTION" value="sync"/>
<server name="SESSION_DRIVER" value="array"/>
<server name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>

0 comments on commit c0da2df

Please sign in to comment.