-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/d3 teams in unfinalized pool (#13)
Fix : empty unfinalized pool's list of tours for D3 teams
- Loading branch information
Showing
4 changed files
with
117 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
bin | ||
test.php | ||
vendor | ||
composer.lock | ||
composer.lock | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
tests/Unit/Service/Operation/ListRencontreOperationTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Alamirault\FFTTApi\Tests\Unit\Service\Operation; | ||
|
||
use Alamirault\FFTTApi\Service\FFTTClient; | ||
use Alamirault\FFTTApi\Service\Operation\ListRencontreOperation; | ||
use Alamirault\FFTTApi\Service\UriGenerator; | ||
use GuzzleHttp\Client; | ||
use GuzzleHttp\HandlerStack; | ||
use GuzzleHttp\Psr7\Response; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @coversDefaultClass \Alamirault\FFTTApi\Service\Operation\ListRencontreOperation | ||
*/ | ||
final class ListRencontreOperationTest extends TestCase | ||
{ | ||
/** | ||
* @covers ::listRencontrePouleByLienDivision | ||
* This test covers the special case of the beginning of phase : D3 teams are assigned in pools that are not yet finalized and therefore empty just for a few hours (hence the cx_poule parameter is not defined in the lien_division param) | ||
*/ | ||
public function testListRencontrePouleByLienDivisionNoTours(): void | ||
{ | ||
/** @var string $responseContent */ | ||
$responseContent = '<?xml version="1.0" encoding="ISO-8859-1"?><liste></liste>'; | ||
$mock = new MockHandlerStub([ | ||
new Response(200, [ | ||
'content-type' => ['text/html; charset=UTF-8'], | ||
], $responseContent), | ||
]); | ||
|
||
$handlerStack = HandlerStack::create($mock); | ||
$client = new Client(['handler' => $handlerStack]); | ||
$FFTTClient = new FFTTClient($client, new UriGenerator('foo', 'bar')); | ||
|
||
$operation = new ListRencontreOperation($FFTTClient); | ||
|
||
$result = $operation->listRencontrePouleByLienDivision('cx_poule=&D1=106641&organisme_pere=105'); | ||
|
||
$this->assertCount(0, $result); | ||
$this->assertEquals([], $result); | ||
} | ||
|
||
/** | ||
* @covers ::listRencontrePouleByLienDivision | ||
*/ | ||
public function testListRencontrePouleByLienDivisionWithTours(): void | ||
{ | ||
/** @var string $responseContent */ | ||
$responseContent = file_get_contents(__DIR__.'/../fixtures/rencontres_by_lien_division.xml'); | ||
$mock = new MockHandlerStub([ | ||
new Response(200, [ | ||
'content-type' => ['text/html; charset=UTF-8'], | ||
], $responseContent), | ||
]); | ||
|
||
$handlerStack = HandlerStack::create($mock); | ||
$client = new Client(['handler' => $handlerStack]); | ||
$FFTTClient = new FFTTClient($client, new UriGenerator('foo', 'bar')); | ||
|
||
$operation = new ListRencontreOperation($FFTTClient); | ||
|
||
$result = $operation->listRencontrePouleByLienDivision('cx_poule=450762&D1=112049&organisme_pere=16'); | ||
|
||
$this->assertCount(28, $result); | ||
|
||
$firstTour = $result[0]; | ||
$this->assertSame('Poule 4 - tour n°1 du 16/12/2022', $firstTour->getLibelle()); | ||
$this->assertSame('HERBLAY (2)', $firstTour->getNomEquipeA()); | ||
$this->assertSame('CHAMBLY (1)', $firstTour->getNomEquipeB()); | ||
$this->assertSame(82, $firstTour->getScoreEquipeA()); | ||
$this->assertSame(80, $firstTour->getScoreEquipeB()); | ||
$this->assertSame('renc_id=1568691&is_retour=0&phase=1&res_1=82&res_2=80&equip_1=HERBLAY+%282%29&equip_2=CHAMBLY+%281%29&equip_id1=19936&equip_id2=19995&clubnum_1=08950479&clubnum_2=08950092', $firstTour->getLien()); | ||
|
||
$fithTour = $result[4]; | ||
$this->assertSame('Poule 4 - tour n°2 du 27/01/2023', $fithTour->getLibelle()); | ||
$this->assertSame('MONTSOULT (1)', $fithTour->getNomEquipeA()); | ||
$this->assertSame('HERBLAY (2)', $fithTour->getNomEquipeB()); | ||
$this->assertSame(0, $fithTour->getScoreEquipeA()); | ||
$this->assertSame(0, $fithTour->getScoreEquipeB()); | ||
$this->assertSame('renc_id=1568695&is_retour=0&phase=1&res_1=&res_2=&equip_1=MONTSOULT+%281%29&equip_2=HERBLAY+%282%29&equip_id1=19929&equip_id2=19936&clubnum_1=08950531&clubnum_2=08950479', $fithTour->getLien()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1"?><liste><tour><libelle>Poule 4 - tour n°1 du 16/12/2022</libelle><equa>HERBLAY (2)</equa><equb>CHAMBLY (1)</equb><scorea>82</scorea><scoreb>80</scoreb><lien><![CDATA[renc_id=1568691&is_retour=0&phase=1&res_1=82&res_2=80&equip_1=HERBLAY+%282%29&equip_2=CHAMBLY+%281%29&equip_id1=19936&equip_id2=19995&clubnum_1=08950479&clubnum_2=08950092]]></lien><dateprevue>16/12/2022</dateprevue><datereelle>16/12/2022</datereelle></tour><tour><libelle>Poule 4 - tour n°1 du 16/12/2022</libelle><equa>MAISONS-LAF. US (1)</equa><equb>MONTSOULT (1)</equb><scorea>92</scorea><scoreb>64</scoreb><lien><![CDATA[renc_id=1568692&is_retour=0&phase=1&res_1=92&res_2=64&equip_1=MAISONS-LAF.+US+%281%29&equip_2=MONTSOULT+%281%29&equip_id1=19939&equip_id2=19929&clubnum_1=08780130&clubnum_2=08950531]]></lien><dateprevue>16/12/2022</dateprevue><datereelle>16/12/2022</datereelle></tour><tour><libelle>Poule 4 - tour n°1 du 16/12/2022</libelle><equa>ARGENTEUIL (1)</equa><equb>FRANCONVILLE (1)</equb><scorea>60</scorea><scoreb>101</scoreb><lien><![CDATA[renc_id=1568693&is_retour=0&phase=1&res_1=60&res_2=101&equip_1=ARGENTEUIL+%281%29&equip_2=FRANCONVILLE+%281%29&equip_id1=19931&equip_id2=19937&clubnum_1=08950623&clubnum_2=08950103]]></lien><dateprevue>16/12/2022</dateprevue><datereelle>16/12/2022</datereelle></tour><tour><libelle>Poule 4 - tour n°1 du 16/12/2022</libelle><equa>LA FRETTE (1)</equa><equb>STAINS ES (1)</equb><scorea>77</scorea><scoreb>85</scoreb><lien><![CDATA[renc_id=1568694&is_retour=0&phase=1&res_1=77&res_2=85&equip_1=LA+FRETTE+%281%29&equip_2=STAINS+ES+%281%29&equip_id1=19933&equip_id2=19914&clubnum_1=08951331&clubnum_2=08931032]]></lien><dateprevue>16/12/2022</dateprevue><datereelle>16/12/2022</datereelle></tour><tour><libelle>Poule 4 - tour n°2 du 27/01/2023</libelle><equa>MONTSOULT (1)</equa><equb>HERBLAY (2)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568695&is_retour=0&phase=1&res_1=&res_2=&equip_1=MONTSOULT+%281%29&equip_2=HERBLAY+%282%29&equip_id1=19929&equip_id2=19936&clubnum_1=08950531&clubnum_2=08950479]]></lien><dateprevue>27/01/2023</dateprevue><datereelle>27/01/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°2 du 27/01/2023</libelle><equa>FRANCONVILLE (1)</equa><equb>MAISONS-LAF. US (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568696&is_retour=0&phase=1&res_1=&res_2=&equip_1=FRANCONVILLE+%281%29&equip_2=MAISONS-LAF.+US+%281%29&equip_id1=19937&equip_id2=19939&clubnum_1=08950103&clubnum_2=08780130]]></lien><dateprevue>27/01/2023</dateprevue><datereelle>27/01/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°2 du 27/01/2023</libelle><equa>STAINS ES (1)</equa><equb>ARGENTEUIL (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568697&is_retour=0&phase=1&res_1=&res_2=&equip_1=STAINS+ES+%281%29&equip_2=ARGENTEUIL+%281%29&equip_id1=19914&equip_id2=19931&clubnum_1=08931032&clubnum_2=08950623]]></lien><dateprevue>27/01/2023</dateprevue><datereelle>27/01/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°2 du 27/01/2023</libelle><equa>CHAMBLY (1)</equa><equb>LA FRETTE (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568698&is_retour=0&phase=1&res_1=&res_2=&equip_1=CHAMBLY+%281%29&equip_2=LA+FRETTE+%281%29&equip_id1=19995&equip_id2=19933&clubnum_1=08950092&clubnum_2=08951331]]></lien><dateprevue>27/01/2023</dateprevue><datereelle>27/01/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°3 du 10/02/2023</libelle><equa>HERBLAY (2)</equa><equb>FRANCONVILLE (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568699&is_retour=0&phase=1&res_1=&res_2=&equip_1=HERBLAY+%282%29&equip_2=FRANCONVILLE+%281%29&equip_id1=19936&equip_id2=19937&clubnum_1=08950479&clubnum_2=08950103]]></lien><dateprevue>10/02/2023</dateprevue><datereelle>10/02/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°3 du 10/02/2023</libelle><equa>MAISONS-LAF. US (1)</equa><equb>STAINS ES (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568700&is_retour=0&phase=1&res_1=&res_2=&equip_1=MAISONS-LAF.+US+%281%29&equip_2=STAINS+ES+%281%29&equip_id1=19939&equip_id2=19914&clubnum_1=08780130&clubnum_2=08931032]]></lien><dateprevue>10/02/2023</dateprevue><datereelle>10/02/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°3 du 10/02/2023</libelle><equa>ARGENTEUIL (1)</equa><equb>LA FRETTE (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568701&is_retour=0&phase=1&res_1=&res_2=&equip_1=ARGENTEUIL+%281%29&equip_2=LA+FRETTE+%281%29&equip_id1=19931&equip_id2=19933&clubnum_1=08950623&clubnum_2=08951331]]></lien><dateprevue>10/02/2023</dateprevue><datereelle>10/02/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°3 du 10/02/2023</libelle><equa>CHAMBLY (1)</equa><equb>MONTSOULT (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568702&is_retour=0&phase=1&res_1=&res_2=&equip_1=CHAMBLY+%281%29&equip_2=MONTSOULT+%281%29&equip_id1=19995&equip_id2=19929&clubnum_1=08950092&clubnum_2=08950531]]></lien><dateprevue>10/02/2023</dateprevue><datereelle>10/02/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°4 du 24/03/2023</libelle><equa>STAINS ES (1)</equa><equb>HERBLAY (2)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568703&is_retour=0&phase=1&res_1=&res_2=&equip_1=STAINS+ES+%281%29&equip_2=HERBLAY+%282%29&equip_id1=19914&equip_id2=19936&clubnum_1=08931032&clubnum_2=08950479]]></lien><dateprevue>24/03/2023</dateprevue><datereelle>24/03/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°4 du 24/03/2023</libelle><equa>LA FRETTE (1)</equa><equb>MAISONS-LAF. US (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568704&is_retour=0&phase=1&res_1=&res_2=&equip_1=LA+FRETTE+%281%29&equip_2=MAISONS-LAF.+US+%281%29&equip_id1=19933&equip_id2=19939&clubnum_1=08951331&clubnum_2=08780130]]></lien><dateprevue>24/03/2023</dateprevue><datereelle>24/03/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°4 du 24/03/2023</libelle><equa>ARGENTEUIL (1)</equa><equb>CHAMBLY (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568705&is_retour=0&phase=1&res_1=&res_2=&equip_1=ARGENTEUIL+%281%29&equip_2=CHAMBLY+%281%29&equip_id1=19931&equip_id2=19995&clubnum_1=08950623&clubnum_2=08950092]]></lien><dateprevue>24/03/2023</dateprevue><datereelle>24/03/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°4 du 24/03/2023</libelle><equa>FRANCONVILLE (1)</equa><equb>MONTSOULT (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568706&is_retour=0&phase=1&res_1=&res_2=&equip_1=FRANCONVILLE+%281%29&equip_2=MONTSOULT+%281%29&equip_id1=19937&equip_id2=19929&clubnum_1=08950103&clubnum_2=08950531]]></lien><dateprevue>24/03/2023</dateprevue><datereelle>24/03/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°5 du 07/04/2023</libelle><equa>HERBLAY (2)</equa><equb>LA FRETTE (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568707&is_retour=0&phase=1&res_1=&res_2=&equip_1=HERBLAY+%282%29&equip_2=LA+FRETTE+%281%29&equip_id1=19936&equip_id2=19933&clubnum_1=08950479&clubnum_2=08951331]]></lien><dateprevue>07/04/2023</dateprevue><datereelle>07/04/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°5 du 07/04/2023</libelle><equa>MAISONS-LAF. US (1)</equa><equb>ARGENTEUIL (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568708&is_retour=0&phase=1&res_1=&res_2=&equip_1=MAISONS-LAF.+US+%281%29&equip_2=ARGENTEUIL+%281%29&equip_id1=19939&equip_id2=19931&clubnum_1=08780130&clubnum_2=08950623]]></lien><dateprevue>07/04/2023</dateprevue><datereelle>07/04/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°5 du 07/04/2023</libelle><equa>MONTSOULT (1)</equa><equb>STAINS ES (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568709&is_retour=0&phase=1&res_1=&res_2=&equip_1=MONTSOULT+%281%29&equip_2=STAINS+ES+%281%29&equip_id1=19929&equip_id2=19914&clubnum_1=08950531&clubnum_2=08931032]]></lien><dateprevue>07/04/2023</dateprevue><datereelle>07/04/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°5 du 07/04/2023</libelle><equa>CHAMBLY (1)</equa><equb>FRANCONVILLE (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568710&is_retour=0&phase=1&res_1=&res_2=&equip_1=CHAMBLY+%281%29&equip_2=FRANCONVILLE+%281%29&equip_id1=19995&equip_id2=19937&clubnum_1=08950092&clubnum_2=08950103]]></lien><dateprevue>07/04/2023</dateprevue><datereelle>07/04/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°6 du 19/05/2023</libelle><equa>ARGENTEUIL (1)</equa><equb>HERBLAY (2)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568711&is_retour=0&phase=1&res_1=&res_2=&equip_1=ARGENTEUIL+%281%29&equip_2=HERBLAY+%282%29&equip_id1=19931&equip_id2=19936&clubnum_1=08950623&clubnum_2=08950479]]></lien><dateprevue>19/05/2023</dateprevue><datereelle>19/05/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°6 du 19/05/2023</libelle><equa>MAISONS-LAF. US (1)</equa><equb>CHAMBLY (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568712&is_retour=0&phase=1&res_1=&res_2=&equip_1=MAISONS-LAF.+US+%281%29&equip_2=CHAMBLY+%281%29&equip_id1=19939&equip_id2=19995&clubnum_1=08780130&clubnum_2=08950092]]></lien><dateprevue>19/05/2023</dateprevue><datereelle>19/05/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°6 du 19/05/2023</libelle><equa>LA FRETTE (1)</equa><equb>MONTSOULT (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568713&is_retour=0&phase=1&res_1=&res_2=&equip_1=LA+FRETTE+%281%29&equip_2=MONTSOULT+%281%29&equip_id1=19933&equip_id2=19929&clubnum_1=08951331&clubnum_2=08950531]]></lien><dateprevue>19/05/2023</dateprevue><datereelle>19/05/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°6 du 19/05/2023</libelle><equa>STAINS ES (1)</equa><equb>FRANCONVILLE (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568714&is_retour=0&phase=1&res_1=&res_2=&equip_1=STAINS+ES+%281%29&equip_2=FRANCONVILLE+%281%29&equip_id1=19914&equip_id2=19937&clubnum_1=08931032&clubnum_2=08950103]]></lien><dateprevue>19/05/2023</dateprevue><datereelle>19/05/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°7 du 02/06/2023</libelle><equa>HERBLAY (2)</equa><equb>MAISONS-LAF. US (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568715&is_retour=0&phase=1&res_1=&res_2=&equip_1=HERBLAY+%282%29&equip_2=MAISONS-LAF.+US+%281%29&equip_id1=19936&equip_id2=19939&clubnum_1=08950479&clubnum_2=08780130]]></lien><dateprevue>02/06/2023</dateprevue><datereelle>02/06/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°7 du 02/06/2023</libelle><equa>MONTSOULT (1)</equa><equb>ARGENTEUIL (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568716&is_retour=0&phase=1&res_1=&res_2=&equip_1=MONTSOULT+%281%29&equip_2=ARGENTEUIL+%281%29&equip_id1=19929&equip_id2=19931&clubnum_1=08950531&clubnum_2=08950623]]></lien><dateprevue>02/06/2023</dateprevue><datereelle>02/06/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°7 du 02/06/2023</libelle><equa>FRANCONVILLE (1)</equa><equb>LA FRETTE (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568717&is_retour=0&phase=1&res_1=&res_2=&equip_1=FRANCONVILLE+%281%29&equip_2=LA+FRETTE+%281%29&equip_id1=19937&equip_id2=19933&clubnum_1=08950103&clubnum_2=08951331]]></lien><dateprevue>02/06/2023</dateprevue><datereelle>02/06/2023</datereelle></tour><tour><libelle>Poule 4 - tour n°7 du 02/06/2023</libelle><equa>CHAMBLY (1)</equa><equb>STAINS ES (1)</equb><scorea/><scoreb/><lien><![CDATA[renc_id=1568718&is_retour=0&phase=1&res_1=&res_2=&equip_1=CHAMBLY+%281%29&equip_2=STAINS+ES+%281%29&equip_id1=19995&equip_id2=19914&clubnum_1=08950092&clubnum_2=08931032]]></lien><dateprevue>02/06/2023</dateprevue><datereelle>02/06/2023</datereelle></tour></liste> |