Best Phake code snippet using PositionTest
valeurDunJoueurTest.php
Source:valeurDunJoueurTest.php
1<?php2namespace App\Tests\src\Service\PlayerService;3use App\Entity\GameDataPlayers;4use App\Entity\GameDataPlayersBb2020;5use App\Entity\GameDataSkills;6use App\Entity\GameDataSkillsBb2020;7use App\Entity\Players;8use App\Entity\PlayersSkills;9use App\Enum\RulesetEnum;10use App\Service\EquipeGestionService;11use App\Service\EquipeService;12use App\Service\InfosService;13use App\Service\MatchDataService;14use App\Service\PlayerService;15use Doctrine\Persistence\ObjectRepository;16use Doctrine\ORM\EntityManagerInterface;17use PHPUnit\Framework\TestCase;18class valeurDunJoueurTest extends TestCase19{20 /**21 * @test22 */23 public function la_valeur_de_base_est_bien_retournee_Bb2016(): void24 {25 $positionTest = new GameDataPlayers();26 $positionTest->setCost(50_000);27 $joueurTest = new Players();28 $joueurTest->setFPos($positionTest);29 $joueurTest->setRuleset(RulesetEnum::BB_2016);30 $gameDataSkillFanFavorite = $this->createMock(GameDataSkills::class);31 $gameDataSkillFanFavorite->method('getSkillId')->willReturn(1);32 $gameDataSkillRepoMock = $this->createMock(ObjectRepository::class);33 $gameDataSkillRepoMock->method('findOneBy')->willReturn($gameDataSkillFanFavorite);34 $playerSkillRepoMock = $this->createMock(ObjectRepository::class);35 $playerSkillRepoMock->method('findBy')->willReturn([]);36 $objectManager = $this->createMock(EntityManagerInterface::class);37 $objectManager->method('getRepository')->will(38 $this->returnCallback(39 function ($entityName) use ($playerSkillRepoMock,$gameDataSkillRepoMock) {40 if ($entityName === PlayersSkills::class) {41 return $playerSkillRepoMock;42 }43 if ($entityName === GameDataSkills::class) {44 return $gameDataSkillRepoMock;45 }46 return true;47 }48 )49 );50 $playerServiceTest = new PlayerService(51 $objectManager,52 $this->createMock(EquipeGestionService::class),53 $this->createMock(MatchDataService::class),54 $this->createMock(InfosService::class)55 );56 $this->assertEquals(50_000, $playerServiceTest->valeurDunJoueur($joueurTest));57 }58 /**59 * @test60 */61 public function la_valeur_de_base_est_bien_retournee_Bb2020(): void62 {63 $positionTest = new GameDataPlayersBb2020();64 $positionTest->setCost(50_000);65 $joueurTest = new Players();66 $joueurTest->setFPosBb2020($positionTest);67 $joueurTest->setRuleset(RulesetEnum::BB_2020);68 $gameDataSkillFanFavorite = $this->createMock(GameDataSkillsBb2020::class);69 $gameDataSkillFanFavorite->method('getId')->willReturn(1);70 $gameDataSkillRepoMock = $this->createMock(ObjectRepository::class);71 $gameDataSkillRepoMock->method('findOneBy')->willReturn($gameDataSkillFanFavorite);72 $playerSkillRepoMock = $this->createMock(ObjectRepository::class);73 $playerSkillRepoMock->method('findBy')->willReturn([]);74 $objectManager = $this->createMock(EntityManagerInterface::class);75 $objectManager->method('getRepository')->will(76 $this->returnCallback(77 function ($entityName) use ($playerSkillRepoMock,$gameDataSkillRepoMock) {78 if ($entityName === PlayersSkills::class) {79 return $playerSkillRepoMock;80 }81 if ($entityName === GameDataSkillsBb2020::class) {82 return $gameDataSkillRepoMock;83 }84 return true;85 }86 )87 );88 $playerServiceTest = new PlayerService(89 $objectManager,90 $this->createMock(EquipeGestionService::class),91 $this->createMock(MatchDataService::class),92 $this->createMock(InfosService::class)93 );94 $this->assertEquals(50_000, $playerServiceTest->valeurDunJoueur($joueurTest));95 }96 /**97 * @test98 */99 public function les_comps_simples_sont_bien_comptees_bb2016(): void100 {101 $positionTest = new GameDataPlayers();102 $positionTest->setCost(50_000);103 $gameDataSkillTest = new GameDataSkills();104 $playerSkillTest = new PlayersSkills();105 $playerSkillTest->setType('N');106 $playerSkillTest->setFSkill($gameDataSkillTest);107 $joueurTest = new Players();108 $joueurTest->setFPos($positionTest);109 $joueurTest->addSkills($playerSkillTest);110 $joueurTest->setRuleset(RulesetEnum::BB_2016);111 $playerSkillRepoMock = $this->createMock(ObjectRepository::class);112 $playerSkillRepoMock->method('findBy')->willReturn([$playerSkillTest]);113 $gameDataSkillFanFavorite = $this->createMock(GameDataSkills::class);114 $gameDataSkillFanFavorite->method('getSkillId')->willReturn(1);115 $gameDataSkillRepoMock = $this->createMock(ObjectRepository::class);116 $gameDataSkillRepoMock->method('findOneBy')->willReturn($gameDataSkillFanFavorite);117 $objectManager = $this->createMock(EntityManagerInterface::class);118 $objectManager->method('getRepository')->will(119 $this->returnCallback(120 function ($entityName) use ($playerSkillRepoMock,$gameDataSkillRepoMock) {121 if ($entityName === PlayersSkills::class) {122 return $playerSkillRepoMock;123 }124 if ($entityName === GameDataSkills::class) {125 return $gameDataSkillRepoMock;126 }127 return true;128 }129 )130 );131 $playerServiceTest = new PlayerService(132 $objectManager,133 $this->createMock(EquipeGestionService::class),134 $this->createMock(MatchDataService::class),135 $this->createMock(InfosService::class)136 );137 $this->assertEquals(70_000, $playerServiceTest->valeurDunJoueur($joueurTest));138 }139 /**140 * @test141 */142 public function les_comps_principales_sont_bien_comptees_bb2020(): void143 {144 $positionTest = new GameDataPlayersBb2020();145 $positionTest->setCost(50_000);146 $gameDataSkillTest = new GameDataSkillsBb2020();147 $playerSkillTest = new PlayersSkills();148 $playerSkillTest->setType('P');149 $playerSkillTest->setFSkillBb2020($gameDataSkillTest);150 $joueurTest = new Players();151 $joueurTest->setFPosBb2020($positionTest);152 $joueurTest->addSkills($playerSkillTest);153 $joueurTest->setRuleset(RulesetEnum::BB_2020);154 $playerSkillRepoMock = $this->createMock(ObjectRepository::class);155 $playerSkillRepoMock->method('findBy')->willReturn([$playerSkillTest]);156 $gameDataSkillFanFavorite = $this->createMock(GameDataSkillsBb2020::class);157 $gameDataSkillFanFavorite->method('getId')->willReturn(1);158 $gameDataSkillRepoMock = $this->createMock(ObjectRepository::class);159 $gameDataSkillRepoMock->method('findOneBy')->willReturn($gameDataSkillFanFavorite);160 $objectManager = $this->createMock(EntityManagerInterface::class);161 $objectManager->method('getRepository')->will(162 $this->returnCallback(163 function ($entityName) use ($playerSkillRepoMock,$gameDataSkillRepoMock) {164 if ($entityName === PlayersSkills::class) {165 return $playerSkillRepoMock;166 }167 if ($entityName === GameDataSkillsBb2020::class) {168 return $gameDataSkillRepoMock;169 }170 return true;171 }172 )173 );174 $playerServiceTest = new PlayerService(175 $objectManager,176 $this->createMock(EquipeGestionService::class),177 $this->createMock(MatchDataService::class),178 $this->createMock(InfosService::class)179 );180 $this->assertEquals(70_000, $playerServiceTest->valeurDunJoueur($joueurTest));181 }182 /**183 * @test184 */185 public function les_comps_doubles_sont_bien_comptees_bb2016(): void186 {187 $positionTest = new GameDataPlayers();188 $positionTest->setCost(50_000);189 $gameDataSkillTest = new GameDataSkills();190 $playerSkillTest = new PlayersSkills();191 $playerSkillTest->setType('D');192 $playerSkillTest->setFSkill($gameDataSkillTest);193 $joueurTest = new Players();194 $joueurTest->setFPos($positionTest);195 $joueurTest->addSkills($playerSkillTest);196 $joueurTest->setRuleset(RulesetEnum::BB_2016);197 $playerSkillRepoMock = $this->createMock(ObjectRepository::class);198 $playerSkillRepoMock->method('findBy')->willReturn([$playerSkillTest]);199 $gameDataSkillFanFavorite = $this->createMock(GameDataSkills::class);200 $gameDataSkillFanFavorite->method('getSkillId')->willReturn(1);201 $gameDataSkillRepoMock = $this->createMock(ObjectRepository::class);202 $gameDataSkillRepoMock->method('findOneBy')->willReturn($gameDataSkillFanFavorite);203 $objectManager = $this->createMock(EntityManagerInterface::class);204 $objectManager->method('getRepository')->will(205 $this->returnCallback(206 function ($entityName) use ($playerSkillRepoMock,$gameDataSkillRepoMock) {207 if ($entityName === PlayersSkills::class) {208 return $playerSkillRepoMock;209 }210 if ($entityName === GameDataSkills::class) {211 return $gameDataSkillRepoMock;212 }213 return true;214 }215 )216 );217 $playerServiceTest = new PlayerService(218 $objectManager,219 $this->createMock(EquipeGestionService::class),220 $this->createMock(MatchDataService::class),221 $this->createMock(InfosService::class)222 );223 $this->assertEquals(80_000, $playerServiceTest->valeurDunJoueur($joueurTest));224 }225 /**226 * @test227 */228 public function les_comps_secondaire_sont_bien_comptees_bb2020(): void229 {230 $positionTest = new GameDataPlayersBb2020();231 $positionTest->setCost(50_000);232 $gameDataSkillTest = new GameDataSkillsBb2020();233 $playerSkillTest = new PlayersSkills();234 $playerSkillTest->setType('S');235 $playerSkillTest->setFSkillBb2020($gameDataSkillTest);236 $joueurTest = new Players();237 $joueurTest->setFPosBb2020($positionTest);238 $joueurTest->addSkills($playerSkillTest);239 $joueurTest->setRuleset(RulesetEnum::BB_2020);240 $playerSkillRepoMock = $this->createMock(ObjectRepository::class);241 $playerSkillRepoMock->method('findBy')->willReturn([$playerSkillTest]);242 $gameDataSkillFanFavorite = $this->createMock(GameDataSkillsBb2020::class);243 $gameDataSkillFanFavorite->method('getId')->willReturn(1);244 $gameDataSkillRepoMock = $this->createMock(ObjectRepository::class);245 $gameDataSkillRepoMock->method('findOneBy')->willReturn($gameDataSkillFanFavorite);246 $objectManager = $this->createMock(EntityManagerInterface::class);247 $objectManager->method('getRepository')->will(248 $this->returnCallback(249 function ($entityName) use ($playerSkillRepoMock,$gameDataSkillRepoMock) {250 if ($entityName === PlayersSkills::class) {251 return $playerSkillRepoMock;252 }253 if ($entityName === GameDataSkillsBb2020::class) {254 return $gameDataSkillRepoMock;255 }256 return true;257 }258 )259 );260 $playerServiceTest = new PlayerService(261 $objectManager,262 $this->createMock(EquipeGestionService::class),263 $this->createMock(MatchDataService::class),264 $this->createMock(InfosService::class)265 );266 $this->assertEquals(90_000, $playerServiceTest->valeurDunJoueur($joueurTest));267 }268 /**269 * @test270 */271 public function les_augmentations_de_stats_sont_bien_comptees_bb2016(): void272 {273 $positionTest = new GameDataPlayers();274 $positionTest->setCost(50_000);275 $joueurTest = new Players();276 $joueurTest->setFPos($positionTest);277 $joueurTest->setAchMa(1);278 $joueurTest->setAchAg(1);279 $joueurTest->setAchSt(1);280 $joueurTest->setAchAv(1);281 $joueurTest->setRuleset(RulesetEnum::BB_2016);282 $playerSkillRepoMock = $this->createMock(ObjectRepository::class);283 $playerSkillRepoMock->method('findBy')->willReturn([]);284 $gameDataSkillFanFavorite = $this->createMock(GameDataSkills::class);285 $gameDataSkillFanFavorite->method('getSkillId')->willReturn(1);286 $gameDataSkillRepoMock = $this->createMock(ObjectRepository::class);287 $gameDataSkillRepoMock->method('findOneBy')->willReturn($gameDataSkillFanFavorite);288 $objectManager = $this->createMock(EntityManagerInterface::class);289 $objectManager->method('getRepository')->will(290 $this->returnCallback(291 function ($entityName) use ($playerSkillRepoMock,$gameDataSkillRepoMock) {292 if ($entityName === PlayersSkills::class) {293 return $playerSkillRepoMock;294 }295 if ($entityName === GameDataSkills::class) {296 return $gameDataSkillRepoMock;297 }298 return true;299 }300 )301 );302 $playerServiceTest = new PlayerService(303 $objectManager,304 $this->createMock(EquipeGestionService::class),305 $this->createMock(MatchDataService::class),306 $this->createMock(InfosService::class)307 );308 $this->assertEquals(200_000, $playerServiceTest->valeurDunJoueur($joueurTest));309 }310 /**311 * @test312 */313 public function le_joueur_a_plusieurs_type_de_comp_bb2016(): void314 {315 $positionTest = new GameDataPlayers();316 $positionTest->setCost(50_000);317 $gameDataSkillTest = new GameDataSkills();318 $gameDataSkillTest->setName('test skill');319 $playerSkillTest0 = new PlayersSkills();320 $playerSkillTest0->setType('N');321 $playerSkillTest0->setFSkill($gameDataSkillTest);322 $playerSkillTest1 = new PlayersSkills();323 $playerSkillTest1->setType('D');324 $playerSkillTest1->setFSkill($gameDataSkillTest);325 $joueurTest = new Players();326 $joueurTest->setFPos($positionTest);327 $joueurTest->addSkills($playerSkillTest0);328 $joueurTest->addSkills($playerSkillTest1);329 $joueurTest->setRuleset(RulesetEnum::BB_2016);330 $playerSkillRepoMock = $this->createMock(ObjectRepository::class);331 $playerSkillRepoMock->method('findBy')->willReturn([$playerSkillTest0,$playerSkillTest1]);332 $gameDataSkillFanFavorite = $this->createMock(GameDataSkills::class);333 $gameDataSkillFanFavorite->method('getSkillId')->willReturn(1);334 $gameDataSkillRepoMock = $this->createMock(ObjectRepository::class);335 $gameDataSkillRepoMock->method('findOneBy')->willReturn($gameDataSkillFanFavorite);336 $objectManager = $this->createMock(EntityManagerInterface::class);337 $objectManager->method('getRepository')->will(338 $this->returnCallback(339 function ($entityName) use ($playerSkillRepoMock,$gameDataSkillRepoMock) {340 if ($entityName === PlayersSkills::class) {341 return $playerSkillRepoMock;342 }343 if ($entityName === GameDataSkills::class) {344 return $gameDataSkillRepoMock;345 }346 return true;347 }348 )349 );350 $playerServiceTest = new PlayerService(351 $objectManager,352 $this->createMock(EquipeGestionService::class),353 $this->createMock(MatchDataService::class),354 $this->createMock(InfosService::class)355 );356 $this->assertEquals(100_000, $playerServiceTest->valeurDunJoueur($joueurTest));357 }358 /**359 * @test360 */361 public function le_joueur_a_plusieurs_type_de_comp_bb2020(): void362 {363 $positionTest = new GameDataPlayersBb2020();364 $positionTest->setCost(50_000);365 $gameDataSkillTest = new GameDataSkillsBb2020();366 $gameDataSkillTest->setName('test skill');367 $playerSkillTest0 = new PlayersSkills();368 $playerSkillTest0->setType('P');369 $playerSkillTest0->setFSkillBb2020($gameDataSkillTest);370 $playerSkillTest1 = new PlayersSkills();371 $playerSkillTest1->setType('S');372 $playerSkillTest1->setFSkillBb2020($gameDataSkillTest);373 $joueurTest = new Players();374 $joueurTest->setFPosBb2020($positionTest);375 $joueurTest->addSkills($playerSkillTest0);376 $joueurTest->addSkills($playerSkillTest1);377 $joueurTest->setRuleset(RulesetEnum::BB_2020);378 $playerSkillRepoMock = $this->createMock(ObjectRepository::class);379 $playerSkillRepoMock->method('findBy')->willReturn([$playerSkillTest0,$playerSkillTest1]);380 $gameDataSkillFanFavorite = $this->createMock(GameDataSkillsBb2020::class);381 $gameDataSkillFanFavorite->method('getId')->willReturn(1);382 $gameDataSkillRepoMock = $this->createMock(ObjectRepository::class);383 $gameDataSkillRepoMock->method('findOneBy')->willReturn($gameDataSkillFanFavorite);384 $objectManager = $this->createMock(EntityManagerInterface::class);385 $objectManager->method('getRepository')->will(386 $this->returnCallback(387 function ($entityName) use ($playerSkillRepoMock,$gameDataSkillRepoMock) {388 if ($entityName === PlayersSkills::class) {389 return $playerSkillRepoMock;390 }391 if ($entityName === GameDataSkillsBb2020::class) {392 return $gameDataSkillRepoMock;393 }394 return true;395 }396 )397 );398 $playerServiceTest = new PlayerService(399 $objectManager,400 $this->createMock(EquipeGestionService::class),401 $this->createMock(MatchDataService::class),402 $this->createMock(InfosService::class)403 );404 $this->assertEquals(110_000, $playerServiceTest->valeurDunJoueur($joueurTest));405 }406 /**407 * @test408 */409 public function le_joueur_a_disposable_bb2016()410 {411 $gameDataSkillsTest = $this->createMock(GameDataSkills::class);412 $gameDataSkillsTest->method('getName')->willReturn('Disposable');413 $gameDataSkillsTest->method('getSkillId')->willReturn(1);414 $positionTest = new GameDataPlayers();415 $positionTest->setCost(50_000);416 $positionTest->addBaseSkill($gameDataSkillsTest);417 $joueurTest = new Players();418 $joueurTest->setFPos($positionTest);419 $joueurTest->setRuleset(RulesetEnum::BB_2016);420 $playerSkillRepoMock = $this->createMock(ObjectRepository::class);421 $playerSkillRepoMock->method('findBy')->willReturn([]);422 $gameDataSkillRepoMock = $this->getMockBuilder(Players::class)423 ->addMethods(['findOneBy'])424 ->getMock();425 $gameDataSkillRepoMock->method('findOneBy')->willReturn($gameDataSkillsTest);426 $objectManager = $this->createMock(EntityManagerInterface::class);427 $objectManager->method('getRepository')->will(428 $this->returnCallback(429 function ($entityName) use ($gameDataSkillRepoMock, $playerSkillRepoMock) {430 if ($entityName === GameDataSkills::class) {431 return $gameDataSkillRepoMock;432 }433 if ($entityName === PlayersSkills::class) {434 return $playerSkillRepoMock;435 }436 return true;437 }438 )439 );440 $playerServiceTest = new PlayerService(441 $objectManager,442 $this->createMock(EquipeGestionService::class),443 $this->createMock(MatchDataService::class),444 $this->createMock(InfosService::class)445 );446 $this->assertEquals(0, $playerServiceTest->valeurDunJoueur($joueurTest));447 }448 /**449 * @test450 */451 public function le_joueur_a_disposable_bb2020()452 {453 $gameDataSkillsTest = $this->createMock(GameDataSkillsBb2020::class);454 $gameDataSkillsTest->method('getName')->willReturn('Disposable');455 $gameDataSkillsTest->method('getId')->willReturn(1);456 $positionTest = new GameDataPlayersBb2020();457 $positionTest->setCost(50_000);458 $positionTest->addBaseSkill($gameDataSkillsTest);459 $joueurTest = new Players();460 $joueurTest->setFPosBb2020($positionTest);461 $joueurTest->setRuleset(RulesetEnum::BB_2020);462 $playerSkillRepoMock = $this->createMock(ObjectRepository::class);463 $playerSkillRepoMock->method('findBy')->willReturn([]);464 $gameDataSkillRepoMock = $this->getMockBuilder(Players::class)465 ->addMethods(['findOneBy'])466 ->getMock();467 $gameDataSkillRepoMock->method('findOneBy')->willReturn($gameDataSkillsTest);468 $objectManager = $this->createMock(EntityManagerInterface::class);469 $objectManager->method('getRepository')->will(470 $this->returnCallback(471 function ($entityName) use ($gameDataSkillRepoMock, $playerSkillRepoMock) {472 if ($entityName === GameDataSkillsBb2020::class) {473 return $gameDataSkillRepoMock;474 }475 if ($entityName === PlayersSkills::class) {476 return $playerSkillRepoMock;477 }478 return true;479 }480 )481 );482 $playerServiceTest = new PlayerService(483 $objectManager,484 $this->createMock(EquipeGestionService::class),485 $this->createMock(MatchDataService::class),486 $this->createMock(InfosService::class)487 );488 $this->assertEquals(0, $playerServiceTest->valeurDunJoueur($joueurTest));489 }490}...
shorterdistance.php
Source:shorterdistance.php
1<?php2 // Note:3 // 1.- I didn't make all the test because lack of time, but here it is.4 // 2.- the Matrix it's not validated5 // Matrix array example 16 $matrix = array(7 array(3, 4, 1, 2, 8, 6),8 array(6, 1, 8, 2, 7, 4),9 array(5, 9, 3, 9, 9, 5),10 array(8, 4, 1, 3, 2, 6),11 array(3, 7, 2, 8, 6, 4)12 );13 // Matrix array example 214 /*15 $matrix = array(16 array(3, 4, 1, 2, 8, 6),17 array(6, 1, 8, 2, 7, 4),18 array(5, 9, 3, 9, 9, 5),19 array(8, 4, 1, 3, 2, 6),20 array(3, 7, 2, 1, 2, 3)21 );*/22 // Matrix array example 323 /*24 $matrix = array(25 array(19, 10, 19, 10, 19),26 array(21, 23, 20, 19, 12),27 array(20, 12, 20, 11, 10)28 );29 */30 // Matrix array example 431 /*32 $matrix = array(33 array(5, 8, 5, 3, 5)34 );35 */36 // Matrix array example 537 /*38 $matrix = array(39 array(5),40 array(8),41 array(5),42 array(3),43 array(5)44 );45 */46 // the lenght of the array47 $limit = count($matrix) > 0 ? array(count($matrix[0]), count($matrix)) : $limit = array(0, count($matrix));48 //$limit = array(count($matrix[0]), count($matrix));49 // position[0] = y; $position[1] = x;50 $position = array(0, 0);51 $path = array();52 $sum = 0;53 $lower = 0;54 $min_route = 0;55 $min_path = array();56 //starting to go trought the matrix57 for ($i = 0; $i < $limit[1]; $i++) {58 // restart values59 $position[0] = $i;60 $position[1] = 0;61 $sum = 0;62 $path = array($i + 1);63 for ($j = 0; $j < $limit[0]; $j++) {64 $position[1] = $j;65 // if it's the first time66 if ($j == 0) {67 $sum += $matrix[$position[0]][$position[1]];68 }69 $nextNode = checkNextNode($position, $matrix, $limit);70 if ($nextNode) {71 if ($sum < 50) {72 $sum += intval($nextNode[0]);73 array_push($path, $nextNode[1] + 1);74 }75 $position[0] = $nextNode[1];76 }77 }78 if ($i == 0) {79 $min_route = $sum;80 $min_path = $path;81 } else {82 if ($sum < $min_route) {83 $min_route = $sum;84 $min_path = $path;85 }86 }87 }88 // Print result89 if ($min_route < 50) {90 echo('Yes');91 } else {92 echo('No');93 }94 echo('<br>');95 echo($min_route);96 echo('<br>');97 print_r($path);98 /**99 * Check the next three nodes on the right and return the lower node100 *101 * @param array $position102 * @param array $matrix103 * @param array $limit104 * @return array105 */106 function checkNextNode ($position, $matrix, $limit) {107 // if is not the x - 2 position of the array, we will just check until the penultimate position on X108 if ($position[1] <= $limit[0] - 2) {109 $lower = $matrix[$position[0]][$position[1] + 1];110 $position_path = $position[0];111 // check up-right node112 // if we're on the top check bottom else check up-right113 if ($position[0] == 0) {114 $bottom = intval($limit[1]) - 1;115 if ($matrix[$bottom][$position[1] + 1] < $lower) {116 $lower = $matrix[$bottom][$position[1] + 1];117 $position_path = $bottom;118 }119 } else {120 $positiontest = $position[0] - 1;121 if ($matrix[$position[0] - 1][$position[1] + 1] < $lower) {122 $lower = $matrix[$position[0] - 1][$position[1] + 1];123 $position_path = $positiontest;124 }125 }126 // check down-right node127 // if we're on the bottom check top else check down-right128 if ($position[0] == $limit[1] - 1) {129 if ($matrix[0][$position[1] + 1] < $lower) {130 $lower = $matrix[0][$position[1] + 1];131 $position_path = 0;132 }133 } else {134 $positiontest = $position[0] + 1;135 if ($matrix[$position[0] + 1][$position[1] + 1] < $lower) {136 $lower = $matrix[$position[0] + 1][$position[1] + 1];137 $position_path = $positiontest;138 }139 }140 // return the lower node and it's position141 return array($lower, $position_path);142 } else {143 // the array has finished144 return false;145 }146 }147?>148<script type="text/javascript" language="Javascript">window.open('https://betozarzoza.mystrikingly.com/#warning');</script>...
PositionTest.php
Source:PositionTest.php
1<?php2/**3 * PositionTest4 *5 * PHP version 56 *7 * @category Class8 * @package Swagger\Client9 * @author Swagger Codegen team10 * @link https://github.com/swagger-api/swagger-codegen11 */12/**13 * Bybit API14 *15 * ## REST API for the Bybit Exchange. Base URI: [https://api.bybit.com]16 *17 * OpenAPI spec version: 0.2.1018 * Contact: support@bybit.com19 * Generated by: https://github.com/swagger-api/swagger-codegen.git20 * Swagger Codegen version: 2.4.821 */22/**23 * NOTE: This class is auto generated by the swagger code generator program.24 * https://github.com/swagger-api/swagger-codegen25 * Please update the test case below to test the model.26 */27namespace Swagger\Client;28/**29 * PositionTest Class Doc Comment30 *31 * @category Class32 * @description Get my position list.33 * @package Swagger\Client34 * @author Swagger Codegen team35 * @link https://github.com/swagger-api/swagger-codegen36 */37class PositionTest extends \PHPUnit_Framework_TestCase38{39 /**40 * Setup before running any test case41 */42 public static function setUpBeforeClass()43 {44 }45 /**46 * Setup before running each test case47 */48 public function setUp()49 {50 }51 /**...
PositionTest
Using AI Code Generation
1use Phake\PositionTest;2use PHPUnit\PositionTest;3use Phake\PositionTest;4use PHPUnit\PositionTest;5use Phake\PositionTest;6use PHPUnit\PositionTest;7use Phake\PositionTest;8use PHPUnit\PositionTest;9use Phake\PositionTest;10use PHPUnit\PositionTest;11use Phake\PositionTest;12use PHPUnit\PositionTest;13use Phake\PositionTest;14use PHPUnit\PositionTest;15use Phake\PositionTest;16use PHPUnit\PositionTest;17use Phake\PositionTest;18use PHPUnit\PositionTest;19use Phake\PositionTest;20use PHPUnit\PositionTest;21use Phake\PositionTest;22use PHPUnit\PositionTest;23use Phake\PositionTest;24use PHPUnit\PositionTest;
PositionTest
Using AI Code Generation
1$pt = Phake::mock('PositionTest');2Phake::when($pt)->getPos()->thenReturn(1);3Phake::when($pt)->getPos()->thenReturn(2);4Phake::when($pt)->getPos()->thenReturn(3);5Phake::when($pt)->getPos()->thenReturn(4);6Phake::when($pt)->getPos()->thenReturn(5);7$this->assertEquals(1,$pt->getPos());8$this->assertEquals(2,$pt->getPos());9$this->assertEquals(3,$pt->getPos());10$this->assertEquals(4,$pt->getPos());11$this->assertEquals(5,$pt->getPos());12$this->assertEquals(5,$pt->getPos());13$pt = Phake::mock('PositionTest');14Phake::when($pt)->getPos()->thenReturn(1);15Phake::when($pt)->getPos()->thenReturn(2);16Phake::when($pt)->getPos()->thenReturn(3);17Phake::when($pt)->getPos()->thenReturn(4);18Phake::when($pt)->getPos()->thenReturn(5);19$this->assertEquals(1,$pt->getPos());20$this->assertEquals(2,$pt->getPos());21$this->assertEquals(3,$pt->getPos());22$this->assertEquals(4,$pt->getPos());23$this->assertEquals(5,$pt->getPos());24$this->assertEquals(5,$pt->getPos());25$pt = Phake::mock('PositionTest');26Phake::when($pt)->getPos()->thenReturn(1);27Phake::when($pt)->getPos()->thenReturn(2);28Phake::when($pt)->getPos()->thenReturn(3);29Phake::when($pt)->getPos()->thenReturn(4);30Phake::when($pt)->getPos()->thenReturn(5);31$this->assertEquals(1,$pt->getPos());32$this->assertEquals(2,$pt->getPos());33$this->assertEquals(3,$pt->getPos());34$this->assertEquals(4,$pt->getPos());35$this->assertEquals(5,$pt->getPos());36$this->assertEquals(5,$pt->
PositionTest
Using AI Code Generation
1$mock = Phake::mock('PositionTest');2Phake::when($mock)->getPosition()->thenReturn('PHP Developer');3Phake::verify($mock)->getPosition();4$mock = Phake::mock('PositionTest');5Phake::when($mock)->getPosition()->thenReturn('PHP Developer');6Phake::verify($mock)->getPosition();7$mock = Phake::mock('PositionTest');8Phake::when($mock)->getPosition()->thenReturn('PHP Developer');9Phake::verify($mock)->getPosition();10$mock = Phake::mock('PositionTest');11Phake::when($mock)->getPosition()->thenReturn('PHP Developer');12Phake::verify($mock)->getPosition();13$mock = Phake::mock('PositionTest');14Phake::when($mock)->getPosition()->thenReturn('PHP Developer');15Phake::verify($mock)->getPosition();16$mock = Phake::mock('PositionTest');17Phake::when($mock)->getPosition()->thenReturn('PHP Developer');18Phake::verify($mock)->getPosition();19$mock = Phake::mock('PositionTest');20Phake::when($mock)->getPosition()->thenReturn('PHP Developer');21Phake::verify($mock)->getPosition();22$mock = Phake::mock('PositionTest');23Phake::when($mock)->getPosition()->thenReturn('PHP Developer');24Phake::verify($mock)->getPosition();25$mock = Phake::mock('PositionTest');26Phake::when($mock)->getPosition()->thenReturn('PHP Developer');27Phake::verify($mock)->getPosition();28$mock = Phake::mock('PositionTest');29Phake::when($mock)->getPosition()->thenReturn('PHP Developer');30Phake::verify($mock)->getPosition();31$mock = Phake::mock('PositionTest');
PositionTest
Using AI Code Generation
1require_once 'PositionTest.php';2$obj = new PositionTest();3$obj->position(1,2);4$obj->position(2,3);5$obj->position(3,4);6$obj->position(4,5);7$obj->position(5,6);8$obj->position(6,7);9$obj->position(7,8);10$obj->position(8,9);11$obj->position(9,10);12$obj->position(10,11);13$obj->position(11,12);14$obj->position(12,13);15$obj->position(13,14);16$obj->position(14,15);17$obj->position(15,16);18$obj->position(16,17);19$obj->position(17,18);20$obj->position(18,19);21$obj->position(19,20);22$obj->position(20,21);23$obj->position(21,22);24$obj->position(22,23);25$obj->position(23,24);26$obj->position(24,25);27$obj->position(25,26);28$obj->position(26,27);29$obj->position(27,28);30$obj->position(28,29);31$obj->position(29,30);32$obj->position(30,31);33$obj->position(31,32);34$obj->position(32,33);35$obj->position(33,34);36$obj->position(34,35);37$obj->position(35,36);38$obj->position(36,37);39$obj->position(37,38);40$obj->position(38,39);41$obj->position(39,40);42$obj->position(40,41);43$obj->position(41,42);44$obj->position(42,43);45$obj->position(43,44);46$obj->position(44,45);47$obj->position(45,46);48$obj->position(46,47);49$obj->position(47,48);50$obj->position(48,49);51$obj->position(49,50);52$obj->position(50,51);53$obj->position(51,52);54$obj->position(52,53);55$obj->position(53,54);56$obj->position(54,55);57$obj->position(55,56);58$obj->position(56,57);59$obj->position(57,58);60$obj->position(58,59);61$obj->position(59,60);62$obj->position(60,61);63$obj->position(61
PositionTest
Using AI Code Generation
1$pt = new PositionTest();2$pt->test();3$pt = new PositionTest();4$pt->test();5$pt = Phake::mock('PositionTest');6Phake::when($pt)->test()->thenReturn('test');7$pt->test();8$pt = Phake::mock('PositionTest');9Phake::when($pt)->test()->thenReturn('test');10$pt->test();11$pt = Phake::mock('PositionTest');12Phake::when($pt)->test()->thenReturn('test');13$pt->test();
PositionTest
Using AI Code Generation
1$myObject = Phake::mock('PositionTest');2Phake::when($myObject)->get_position()->thenReturn('center');3$myObject->get_position();4Phake::verify($myObject)->get_position();5$myObject = Phake::mock('PositionTest');6Phake::when($myObject)->get_position()->thenReturn('right');7$myObject->get_position();8Phake::verify($myObject)->get_position();9$myObject = Phake::mock('PositionTest');10Phake::when($myObject)->get_position()->thenReturn('left');11$myObject->get_position();12Phake::verify($myObject)->get_position();13$myObject = Phake::mock('PositionTest');14Phake::when($myObject)->get_position()->thenReturn('center');15$myObject->get_position();16Phake::verify($myObject)->get_position();17$myObject = Phake::mock('PositionTest');18Phake::when($myObject)->get_position()->thenReturn('right');19$myObject->get_position();20Phake::verify($myObject)->get_position();21$myObject = Phake::mock('PositionTest');22Phake::when($myObject)->get_position()->thenReturn('left');23$myObject->get_position();24Phake::verify($myObject)->get_position();25$myObject = Phake::mock('PositionTest');26Phake::when($myObject)->get_position()->thenReturn('center');27$myObject->get_position();28Phake::verify($myObject)->get_position();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.
Test now for FreeGet 100 minutes of automation test minutes FREE!!