Best Atoum code snippet using version
installed.php
Source:installed.php
1<?php return array (2 'root' => 3 array (4 'pretty_version' => 'dev-master',5 'version' => 'dev-master',6 'aliases' => 7 array (8 ),9 'reference' => '5d3fb4bbf495ecda06bbd8f44c91bddddb5050d1',10 'name' => 'laravel/laravel',11 ),12 'versions' => 13 array (14 'arrilot/laravel-widgets' => 15 array (16 'pretty_version' => '3.13.1',17 'version' => '3.13.1.0',18 'aliases' => 19 array (20 ),21 'reference' => 'ae0e44ce625026ae71c6ab9259f89f13af227e37',22 ),23 'asm89/stack-cors' => 24 array (25 'pretty_version' => '1.3.0',26 'version' => '1.3.0.0',27 'aliases' => 28 array (29 ),30 'reference' => 'b9c31def6a83f84b4d4a40d35996d375755f0e08',31 ),32 'brick/math' => 33 array (34 'pretty_version' => '0.9.1',35 'version' => '0.9.1.0',36 'aliases' => 37 array (38 ),39 'reference' => '283a40c901101e66de7061bd359252c013dcc43c',40 ),41 'composer/ca-bundle' => 42 array (43 'pretty_version' => '1.2.8',44 'version' => '1.2.8.0',45 'aliases' => 46 array (47 ),48 'reference' => '8a7ecad675253e4654ea05505233285377405215',49 ),50 'composer/composer' => 51 array (52 'pretty_version' => '2.0.7',53 'version' => '2.0.7.0',54 'aliases' => 55 array (56 ),57 'reference' => 'cbee637510037f293e641857b2a6223d0ea8008d',58 ),59 'composer/semver' => 60 array (61 'pretty_version' => '3.2.4',62 'version' => '3.2.4.0',63 'aliases' => 64 array (65 ),66 'reference' => 'a02fdf930a3c1c3ed3a49b5f63859c0c20e10464',67 ),68 'composer/spdx-licenses' => 69 array (70 'pretty_version' => '1.5.4',71 'version' => '1.5.4.0',72 'aliases' => 73 array (74 ),75 'reference' => '6946f785871e2314c60b4524851f3702ea4f2223',76 ),77 'composer/xdebug-handler' => 78 array (79 'pretty_version' => '1.4.5',80 'version' => '1.4.5.0',81 'aliases' => 82 array (83 ),84 'reference' => 'f28d44c286812c714741478d968104c5e604a1d4',85 ),86 'cordoval/hamcrest-php' => 87 array (88 'replaced' => 89 array (90 0 => '*',91 ),92 ),93 'darryldecode/cart' => 94 array (95 'pretty_version' => '4.2.0',96 'version' => '4.2.0.0',97 'aliases' => 98 array (99 ),100 'reference' => '7dcaddea121bf7724834ff3448b0d052a458d207',101 ),102 'davedevelopment/hamcrest-php' => 103 array (104 'replaced' => 105 array (106 0 => '*',107 ),108 ),109 'dnoegel/php-xdg-base-dir' => 110 array (111 'pretty_version' => 'v0.1.1',112 'version' => '0.1.1.0',113 'aliases' => 114 array (115 ),116 'reference' => '8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd',117 ),118 'doctrine/cache' => 119 array (120 'pretty_version' => '1.10.2',121 'version' => '1.10.2.0',122 'aliases' => 123 array (124 ),125 'reference' => '13e3381b25847283a91948d04640543941309727',126 ),127 'doctrine/dbal' => 128 array (129 'pretty_version' => '2.12.1',130 'version' => '2.12.1.0',131 'aliases' => 132 array (133 ),134 'reference' => 'adce7a954a1c2f14f85e94aed90c8489af204086',135 ),136 'doctrine/event-manager' => 137 array (138 'pretty_version' => '1.1.1',139 'version' => '1.1.1.0',140 'aliases' => 141 array (142 ),143 'reference' => '41370af6a30faa9dc0368c4a6814d596e81aba7f',144 ),145 'doctrine/inflector' => 146 array (147 'pretty_version' => '2.0.3',148 'version' => '2.0.3.0',149 'aliases' => 150 array (151 ),152 'reference' => '9cf661f4eb38f7c881cac67c75ea9b00bf97b210',153 ),154 'doctrine/instantiator' => 155 array (156 'pretty_version' => '1.4.0',157 'version' => '1.4.0.0',158 'aliases' => 159 array (160 ),161 'reference' => 'd56bf6102915de5702778fe20f2de3b2fe570b5b',162 ),163 'doctrine/lexer' => 164 array (165 'pretty_version' => '1.2.1',166 'version' => '1.2.1.0',167 'aliases' => 168 array (169 ),170 'reference' => 'e864bbf5904cb8f5bb334f99209b48018522f042',171 ),172 'dragonmantank/cron-expression' => 173 array (174 'pretty_version' => 'v2.3.1',175 'version' => '2.3.1.0',176 'aliases' => 177 array (178 ),179 'reference' => '65b2d8ee1f10915efb3b55597da3404f096acba2',180 ),181 'egulias/email-validator' => 182 array (183 'pretty_version' => '2.1.24',184 'version' => '2.1.24.0',185 'aliases' => 186 array (187 ),188 'reference' => 'ca90a3291eee1538cd48ff25163240695bd95448',189 ),190 'facade/flare-client-php' => 191 array (192 'pretty_version' => '1.3.7',193 'version' => '1.3.7.0',194 'aliases' => 195 array (196 ),197 'reference' => 'fd688d3c06658f2b3b5f7bb19f051ee4ddf02492',198 ),199 'facade/ignition' => 200 array (201 'pretty_version' => '2.5.2',202 'version' => '2.5.2.0',203 'aliases' => 204 array (205 ),206 'reference' => '08668034beb185fa2ac6f09b1034eaa440952ace',207 ),208 'facade/ignition-contracts' => 209 array (210 'pretty_version' => '1.0.2',211 'version' => '1.0.2.0',212 'aliases' => 213 array (214 ),215 'reference' => '3c921a1cdba35b68a7f0ccffc6dffc1995b18267',216 ),217 'fideloper/proxy' => 218 array (219 'pretty_version' => '4.4.1',220 'version' => '4.4.1.0',221 'aliases' => 222 array (223 ),224 'reference' => 'c073b2bd04d1c90e04dc1b787662b558dd65ade0',225 ),226 'filp/whoops' => 227 array (228 'pretty_version' => '2.9.1',229 'version' => '2.9.1.0',230 'aliases' => 231 array (232 ),233 'reference' => '307fb34a5ab697461ec4c9db865b20ff2fd40771',234 ),235 'fruitcake/laravel-cors' => 236 array (237 'pretty_version' => 'v1.0.6',238 'version' => '1.0.6.0',239 'aliases' => 240 array (241 ),242 'reference' => '1d127dbec313e2e227d65e0c483765d8d7559bf6',243 ),244 'fzaninotto/faker' => 245 array (246 'pretty_version' => 'v1.9.1',247 'version' => '1.9.1.0',248 'aliases' => 249 array (250 ),251 'reference' => 'fc10d778e4b84d5bd315dad194661e091d307c6f',252 ),253 'guzzlehttp/guzzle' => 254 array (255 'pretty_version' => '6.5.5',256 'version' => '6.5.5.0',257 'aliases' => 258 array (259 ),260 'reference' => '9d4290de1cfd701f38099ef7e183b64b4b7b0c5e',261 ),262 'guzzlehttp/promises' => 263 array (264 'pretty_version' => '1.4.0',265 'version' => '1.4.0.0',266 'aliases' => 267 array (268 ),269 'reference' => '60d379c243457e073cff02bc323a2a86cb355631',270 ),271 'guzzlehttp/psr7' => 272 array (273 'pretty_version' => '1.7.0',274 'version' => '1.7.0.0',275 'aliases' => 276 array (277 ),278 'reference' => '53330f47520498c0ae1f61f7e2c90f55690c06a3',279 ),280 'hamcrest/hamcrest-php' => 281 array (282 'pretty_version' => 'v2.0.1',283 'version' => '2.0.1.0',284 'aliases' => 285 array (286 ),287 'reference' => '8c3d0a3f6af734494ad8f6fbbee0ba92422859f3',288 ),289 'illuminate/auth' => 290 array (291 'replaced' => 292 array (293 0 => 'v7.29.3',294 ),295 ),296 'illuminate/broadcasting' => 297 array (298 'replaced' => 299 array (300 0 => 'v7.29.3',301 ),302 ),303 'illuminate/bus' => 304 array (305 'replaced' => 306 array (307 0 => 'v7.29.3',308 ),309 ),310 'illuminate/cache' => 311 array (312 'replaced' => 313 array (314 0 => 'v7.29.3',315 ),316 ),317 'illuminate/config' => 318 array (319 'replaced' => 320 array (321 0 => 'v7.29.3',322 ),323 ),324 'illuminate/console' => 325 array (326 'replaced' => 327 array (328 0 => 'v7.29.3',329 ),330 ),331 'illuminate/container' => 332 array (333 'replaced' => 334 array (335 0 => 'v7.29.3',336 ),337 ),338 'illuminate/contracts' => 339 array (340 'replaced' => 341 array (342 0 => 'v7.29.3',343 ),344 ),345 'illuminate/cookie' => 346 array (347 'replaced' => 348 array (349 0 => 'v7.29.3',350 ),351 ),352 'illuminate/database' => 353 array (354 'replaced' => 355 array (356 0 => 'v7.29.3',357 ),358 ),359 'illuminate/encryption' => 360 array (361 'replaced' => 362 array (363 0 => 'v7.29.3',364 ),365 ),366 'illuminate/events' => 367 array (368 'replaced' => 369 array (370 0 => 'v7.29.3',371 ),372 ),373 'illuminate/filesystem' => 374 array (375 'replaced' => 376 array (377 0 => 'v7.29.3',378 ),379 ),380 'illuminate/hashing' => 381 array (382 'replaced' => 383 array (384 0 => 'v7.29.3',385 ),386 ),387 'illuminate/http' => 388 array (389 'replaced' => 390 array (391 0 => 'v7.29.3',392 ),393 ),394 'illuminate/log' => 395 array (396 'replaced' => 397 array (398 0 => 'v7.29.3',399 ),400 ),401 'illuminate/mail' => 402 array (403 'replaced' => 404 array (405 0 => 'v7.29.3',406 ),407 ),408 'illuminate/notifications' => 409 array (410 'replaced' => 411 array (412 0 => 'v7.29.3',413 ),414 ),415 'illuminate/pagination' => 416 array (417 'replaced' => 418 array (419 0 => 'v7.29.3',420 ),421 ),422 'illuminate/pipeline' => 423 array (424 'replaced' => 425 array (426 0 => 'v7.29.3',427 ),428 ),429 'illuminate/queue' => 430 array (431 'replaced' => 432 array (433 0 => 'v7.29.3',434 ),435 ),436 'illuminate/redis' => 437 array (438 'replaced' => 439 array (440 0 => 'v7.29.3',441 ),442 ),443 'illuminate/routing' => 444 array (445 'replaced' => 446 array (447 0 => 'v7.29.3',448 ),449 ),450 'illuminate/session' => 451 array (452 'replaced' => 453 array (454 0 => 'v7.29.3',455 ),456 ),457 'illuminate/support' => 458 array (459 'replaced' => 460 array (461 0 => 'v7.29.3',462 ),463 ),464 'illuminate/testing' => 465 array (466 'replaced' => 467 array (468 0 => 'v7.29.3',469 ),470 ),471 'illuminate/translation' => 472 array (473 'replaced' => 474 array (475 0 => 'v7.29.3',476 ),477 ),478 'illuminate/validation' => 479 array (480 'replaced' => 481 array (482 0 => 'v7.29.3',483 ),484 ),485 'illuminate/view' => 486 array (487 'replaced' => 488 array (489 0 => 'v7.29.3',490 ),491 ),492 'intervention/image' => 493 array (494 'pretty_version' => '2.5.1',495 'version' => '2.5.1.0',496 'aliases' => 497 array (498 ),499 'reference' => 'abbf18d5ab8367f96b3205ca3c89fb2fa598c69e',500 ),501 'justinrainbow/json-schema' => 502 array (503 'pretty_version' => '5.2.10',504 'version' => '5.2.10.0',505 'aliases' => 506 array (507 ),508 'reference' => '2ba9c8c862ecd5510ed16c6340aa9f6eadb4f31b',509 ),510 'kodova/hamcrest-php' => 511 array (512 'replaced' => 513 array (514 0 => '*',515 ),516 ),517 'larapack/doctrine-support' => 518 array (519 'pretty_version' => 'v0.1.9',520 'version' => '0.1.9.0',521 'aliases' => 522 array (523 ),524 'reference' => 'ab6e821c467704ae91a9a944e6ebdaad6a99a294',525 ),526 'larapack/hooks' => 527 array (528 'pretty_version' => 'v1.0.12',529 'version' => '1.0.12.0',530 'aliases' => 531 array (532 ),533 'reference' => 'ce2c8c078a56036c357f26036174412cb9059f8e',534 ),535 'larapack/voyager-hooks' => 536 array (537 'pretty_version' => 'v1.2.3',538 'version' => '1.2.3.0',539 'aliases' => 540 array (541 ),542 'reference' => '1a54df95b4179a9d26e9aacbd8676c8ccd78be0e',543 ),544 'laravel/framework' => 545 array (546 'pretty_version' => 'v7.29.3',547 'version' => '7.29.3.0',548 'aliases' => 549 array (550 ),551 'reference' => '93f6d565a07045baa0e4b941ae1f733cd5984d65',552 ),553 'laravel/laravel' => 554 array (555 'pretty_version' => 'dev-master',556 'version' => 'dev-master',557 'aliases' => 558 array (559 ),560 'reference' => '5d3fb4bbf495ecda06bbd8f44c91bddddb5050d1',561 ),562 'laravel/tinker' => 563 array (564 'pretty_version' => 'v2.5.0',565 'version' => '2.5.0.0',566 'aliases' => 567 array (568 ),569 'reference' => '45884b526e10a88a1b179fa1a1a24d5468c668c2',570 ),571 'laravel/ui' => 572 array (573 'pretty_version' => 'v2.5.0',574 'version' => '2.5.0.0',575 'aliases' => 576 array (577 ),578 'reference' => 'd01a705763c243b07be795e9d1bb47f89260f73d',579 ),580 'league/commonmark' => 581 array (582 'pretty_version' => '1.5.7',583 'version' => '1.5.7.0',584 'aliases' => 585 array (586 ),587 'reference' => '11df9b36fd4f1d2b727a73bf14931d81373b9a54',588 ),589 'league/flysystem' => 590 array (591 'pretty_version' => '1.1.3',592 'version' => '1.1.3.0',593 'aliases' => 594 array (595 ),596 'reference' => '9be3b16c877d477357c015cec057548cf9b2a14a',597 ),598 'league/mime-type-detection' => 599 array (600 'pretty_version' => '1.5.1',601 'version' => '1.5.1.0',602 'aliases' => 603 array (604 ),605 'reference' => '353f66d7555d8a90781f6f5e7091932f9a4250aa',606 ),607 'mockery/mockery' => 608 array (609 'pretty_version' => '1.4.2',610 'version' => '1.4.2.0',611 'aliases' => 612 array (613 ),614 'reference' => '20cab678faed06fac225193be281ea0fddb43b93',615 ),616 'monolog/monolog' => 617 array (618 'pretty_version' => '2.1.1',619 'version' => '2.1.1.0',620 'aliases' => 621 array (622 ),623 'reference' => 'f9eee5cec93dfb313a38b6b288741e84e53f02d5',624 ),625 'myclabs/deep-copy' => 626 array (627 'pretty_version' => '1.10.2',628 'version' => '1.10.2.0',629 'aliases' => 630 array (631 ),632 'reference' => '776f831124e9c62e1a2c601ecc52e776d8bb7220',633 'replaced' => 634 array (635 0 => '1.10.2',636 ),637 ),638 'nesbot/carbon' => 639 array (640 'pretty_version' => '2.41.5',641 'version' => '2.41.5.0',642 'aliases' => 643 array (644 ),645 'reference' => 'c4a9caf97cfc53adfc219043bcecf42bc663acee',646 ),647 'nikic/php-parser' => 648 array (649 'pretty_version' => 'v4.10.2',650 'version' => '4.10.2.0',651 'aliases' => 652 array (653 ),654 'reference' => '658f1be311a230e0907f5dfe0213742aff0596de',655 ),656 'nunomaduro/collision' => 657 array (658 'pretty_version' => 'v4.3.0',659 'version' => '4.3.0.0',660 'aliases' => 661 array (662 ),663 'reference' => '7c125dc2463f3e144ddc7e05e63077109508c94e',664 ),665 'opis/closure' => 666 array (667 'pretty_version' => '3.6.1',668 'version' => '3.6.1.0',669 'aliases' => 670 array (671 ),672 'reference' => '943b5d70cc5ae7483f6aff6ff43d7e34592ca0f5',673 ),674 'phar-io/manifest' => 675 array (676 'pretty_version' => '1.0.3',677 'version' => '1.0.3.0',678 'aliases' => 679 array (680 ),681 'reference' => '7761fcacf03b4d4f16e7ccb606d4879ca431fcf4',682 ),683 'phar-io/version' => 684 array (685 'pretty_version' => '2.0.1',686 'version' => '2.0.1.0',687 'aliases' => 688 array (689 ),690 'reference' => '45a2ec53a73c70ce41d55cedef9063630abaf1b6',691 ),692 'phpdocumentor/reflection-common' => 693 array (694 'pretty_version' => '2.2.0',695 'version' => '2.2.0.0',696 'aliases' => 697 array (698 ),699 'reference' => '1d01c49d4ed62f25aa84a747ad35d5a16924662b',700 ),701 'phpdocumentor/reflection-docblock' => 702 array (703 'pretty_version' => '5.2.2',704 'version' => '5.2.2.0',705 'aliases' => 706 array (707 ),708 'reference' => '069a785b2141f5bcf49f3e353548dc1cce6df556',709 ),710 'phpdocumentor/type-resolver' => 711 array (712 'pretty_version' => '1.4.0',713 'version' => '1.4.0.0',714 'aliases' => 715 array (716 ),717 'reference' => '6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0',718 ),719 'phpoption/phpoption' => 720 array (721 'pretty_version' => '1.7.5',722 'version' => '1.7.5.0',723 'aliases' => 724 array (725 ),726 'reference' => '994ecccd8f3283ecf5ac33254543eb0ac946d525',727 ),728 'phpspec/prophecy' => 729 array (730 'pretty_version' => '1.12.1',731 'version' => '1.12.1.0',732 'aliases' => 733 array (734 ),735 'reference' => '8ce87516be71aae9b956f81906aaf0338e0d8a2d',736 ),737 'phpunit/php-code-coverage' => 738 array (739 'pretty_version' => '7.0.10',740 'version' => '7.0.10.0',741 'aliases' => 742 array (743 ),744 'reference' => 'f1884187926fbb755a9aaf0b3836ad3165b478bf',745 ),746 'phpunit/php-file-iterator' => 747 array (748 'pretty_version' => '2.0.2',749 'version' => '2.0.2.0',750 'aliases' => 751 array (752 ),753 'reference' => '050bedf145a257b1ff02746c31894800e5122946',754 ),755 'phpunit/php-text-template' => 756 array (757 'pretty_version' => '1.2.1',758 'version' => '1.2.1.0',759 'aliases' => 760 array (761 ),762 'reference' => '31f8b717e51d9a2afca6c9f046f5d69fc27c8686',763 ),764 'phpunit/php-timer' => 765 array (766 'pretty_version' => '2.1.2',767 'version' => '2.1.2.0',768 'aliases' => 769 array (770 ),771 'reference' => '1038454804406b0b5f5f520358e78c1c2f71501e',772 ),773 'phpunit/php-token-stream' => 774 array (775 'pretty_version' => '3.1.1',776 'version' => '3.1.1.0',777 'aliases' => 778 array (779 ),780 'reference' => '995192df77f63a59e47f025390d2d1fdf8f425ff',781 ),782 'phpunit/phpunit' => 783 array (784 'pretty_version' => '8.5.9',785 'version' => '8.5.9.0',786 'aliases' => 787 array (788 ),789 'reference' => 'f5c8a5dd5e7e8d68d7562bfb48d47287d33937d6',790 ),791 'psr/container' => 792 array (793 'pretty_version' => '1.0.0',794 'version' => '1.0.0.0',795 'aliases' => 796 array (797 ),798 'reference' => 'b7ce3b176482dbbc1245ebf52b181af44c2cf55f',799 ),800 'psr/container-implementation' => 801 array (802 'provided' => 803 array (804 0 => '1.0',805 ),806 ),807 'psr/event-dispatcher' => 808 array (809 'pretty_version' => '1.0.0',810 'version' => '1.0.0.0',811 'aliases' => 812 array (813 ),814 'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',815 ),816 'psr/event-dispatcher-implementation' => 817 array (818 'provided' => 819 array (820 0 => '1.0',821 ),822 ),823 'psr/http-message' => 824 array (825 'pretty_version' => '1.0.1',826 'version' => '1.0.1.0',827 'aliases' => 828 array (829 ),830 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',831 ),832 'psr/http-message-implementation' => 833 array (834 'provided' => 835 array (836 0 => '1.0',837 ),838 ),839 'psr/log' => 840 array (841 'pretty_version' => '1.1.3',842 'version' => '1.1.3.0',843 'aliases' => 844 array (845 ),846 'reference' => '0f73288fd15629204f9d42b7055f72dacbe811fc',847 ),848 'psr/log-implementation' => 849 array (850 'provided' => 851 array (852 0 => '1.0.0',853 1 => '1.0',854 ),855 ),856 'psr/simple-cache' => 857 array (858 'pretty_version' => '1.0.1',859 'version' => '1.0.1.0',860 'aliases' => 861 array (862 ),863 'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b',864 ),865 'psy/psysh' => 866 array (867 'pretty_version' => 'v0.10.4',868 'version' => '0.10.4.0',869 'aliases' => 870 array (871 ),872 'reference' => 'a8aec1b2981ab66882a01cce36a49b6317dc3560',873 ),874 'ralouphie/getallheaders' => 875 array (876 'pretty_version' => '3.0.3',877 'version' => '3.0.3.0',878 'aliases' => 879 array (880 ),881 'reference' => '120b605dfeb996808c31b6477290a714d356e822',882 ),883 'ramsey/collection' => 884 array (885 'pretty_version' => '1.1.1',886 'version' => '1.1.1.0',887 'aliases' => 888 array (889 ),890 'reference' => '24d93aefb2cd786b7edd9f45b554aea20b28b9b1',891 ),892 'ramsey/uuid' => 893 array (894 'pretty_version' => '4.1.1',895 'version' => '4.1.1.0',896 'aliases' => 897 array (898 ),899 'reference' => 'cd4032040a750077205918c86049aa0f43d22947',900 ),901 'react/promise' => 902 array (903 'pretty_version' => 'v2.8.0',904 'version' => '2.8.0.0',905 'aliases' => 906 array (907 ),908 'reference' => 'f3cff96a19736714524ca0dd1d4130de73dbbbc4',909 ),910 'rhumsaa/uuid' => 911 array (912 'replaced' => 913 array (914 0 => '4.1.1',915 ),916 ),917 'sebastian/code-unit-reverse-lookup' => 918 array (919 'pretty_version' => '1.0.1',920 'version' => '1.0.1.0',921 'aliases' => 922 array (923 ),924 'reference' => '4419fcdb5eabb9caa61a27c7a1db532a6b55dd18',925 ),926 'sebastian/comparator' => 927 array (928 'pretty_version' => '3.0.2',929 'version' => '3.0.2.0',930 'aliases' => 931 array (932 ),933 'reference' => '5de4fc177adf9bce8df98d8d141a7559d7ccf6da',934 ),935 'sebastian/diff' => 936 array (937 'pretty_version' => '3.0.2',938 'version' => '3.0.2.0',939 'aliases' => 940 array (941 ),942 'reference' => '720fcc7e9b5cf384ea68d9d930d480907a0c1a29',943 ),944 'sebastian/environment' => 945 array (946 'pretty_version' => '4.2.3',947 'version' => '4.2.3.0',948 'aliases' => 949 array (950 ),951 'reference' => '464c90d7bdf5ad4e8a6aea15c091fec0603d4368',952 ),953 'sebastian/exporter' => 954 array (955 'pretty_version' => '3.1.2',956 'version' => '3.1.2.0',957 'aliases' => 958 array (959 ),960 'reference' => '68609e1261d215ea5b21b7987539cbfbe156ec3e',961 ),962 'sebastian/global-state' => 963 array (964 'pretty_version' => '3.0.0',965 'version' => '3.0.0.0',966 'aliases' => 967 array (968 ),969 'reference' => 'edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4',970 ),971 'sebastian/object-enumerator' => 972 array (973 'pretty_version' => '3.0.3',974 'version' => '3.0.3.0',975 'aliases' => 976 array (977 ),978 'reference' => '7cfd9e65d11ffb5af41198476395774d4c8a84c5',979 ),980 'sebastian/object-reflector' => 981 array (982 'pretty_version' => '1.1.1',983 'version' => '1.1.1.0',984 'aliases' => 985 array (986 ),987 'reference' => '773f97c67f28de00d397be301821b06708fca0be',988 ),989 'sebastian/recursion-context' => 990 array (991 'pretty_version' => '3.0.0',992 'version' => '3.0.0.0',993 'aliases' => 994 array (995 ),996 'reference' => '5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8',997 ),998 'sebastian/resource-operations' => 999 array (1000 'pretty_version' => '2.0.1',1001 'version' => '2.0.1.0',1002 'aliases' => 1003 array (1004 ),1005 'reference' => '4d7a795d35b889bf80a0cc04e08d77cedfa917a9',1006 ),1007 'sebastian/type' => 1008 array (1009 'pretty_version' => '1.1.3',1010 'version' => '1.1.3.0',1011 'aliases' => 1012 array (1013 ),1014 'reference' => '3aaaa15fa71d27650d62a948be022fe3b48541a3',1015 ),1016 'sebastian/version' => 1017 array (1018 'pretty_version' => '2.0.1',1019 'version' => '2.0.1.0',1020 'aliases' => 1021 array (1022 ),1023 'reference' => '99732be0ddb3361e16ad77b68ba41efc8e979019',1024 ),1025 'seld/jsonlint' => 1026 array (1027 'pretty_version' => '1.8.3',1028 'version' => '1.8.3.0',1029 'aliases' => 1030 array (1031 ),1032 'reference' => '9ad6ce79c342fbd44df10ea95511a1b24dee5b57',1033 ),1034 'seld/phar-utils' => 1035 array (1036 'pretty_version' => '1.1.1',1037 'version' => '1.1.1.0',1038 'aliases' => 1039 array (1040 ),1041 'reference' => '8674b1d84ffb47cc59a101f5d5a3b61e87d23796',1042 ),1043 'srmklive/paypal' => 1044 array (1045 'pretty_version' => '1.8.0',1046 'version' => '1.8.0.0',1047 'aliases' => 1048 array (1049 ),1050 'reference' => '0c2ae237577f62396d474674cb40f82825a41ffb',1051 ),1052 'swiftmailer/swiftmailer' => 1053 array (1054 'pretty_version' => 'v6.2.3',1055 'version' => '6.2.3.0',1056 'aliases' => 1057 array (1058 ),1059 'reference' => '149cfdf118b169f7840bbe3ef0d4bc795d1780c9',1060 ),1061 'symfony/console' => 1062 array (1063 'pretty_version' => 'v5.1.8',1064 'version' => '5.1.8.0',1065 'aliases' => 1066 array (1067 ),1068 'reference' => 'e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e',1069 ),1070 'symfony/css-selector' => 1071 array (1072 'pretty_version' => 'v5.1.8',1073 'version' => '5.1.8.0',1074 'aliases' => 1075 array (1076 ),1077 'reference' => '6cbebda22ffc0d4bb8fea0c1311c2ca54c4c8fa0',1078 ),1079 'symfony/deprecation-contracts' => 1080 array (1081 'pretty_version' => 'v2.2.0',1082 'version' => '2.2.0.0',1083 'aliases' => 1084 array (1085 ),1086 'reference' => '5fa56b4074d1ae755beb55617ddafe6f5d78f665',1087 ),1088 'symfony/error-handler' => 1089 array (1090 'pretty_version' => 'v5.1.8',1091 'version' => '5.1.8.0',1092 'aliases' => 1093 array (1094 ),1095 'reference' => 'a154f2b12fd1ec708559ba73ed58bd1304e55718',1096 ),1097 'symfony/event-dispatcher' => 1098 array (1099 'pretty_version' => 'v5.1.8',1100 'version' => '5.1.8.0',1101 'aliases' => 1102 array (1103 ),1104 'reference' => '26f4edae48c913fc183a3da0553fe63bdfbd361a',1105 ),1106 'symfony/event-dispatcher-contracts' => 1107 array (1108 'pretty_version' => 'v2.2.0',1109 'version' => '2.2.0.0',1110 'aliases' => 1111 array (1112 ),1113 'reference' => '0ba7d54483095a198fa51781bc608d17e84dffa2',1114 ),1115 'symfony/event-dispatcher-implementation' => 1116 array (1117 'provided' => 1118 array (1119 0 => '2.0',1120 ),1121 ),1122 'symfony/filesystem' => 1123 array (1124 'pretty_version' => 'v5.1.8',1125 'version' => '5.1.8.0',1126 'aliases' => 1127 array (1128 ),1129 'reference' => 'df08650ea7aee2d925380069c131a66124d79177',1130 ),1131 'symfony/finder' => 1132 array (1133 'pretty_version' => 'v5.1.8',1134 'version' => '5.1.8.0',1135 'aliases' => 1136 array (1137 ),1138 'reference' => 'e70eb5a69c2ff61ea135a13d2266e8914a67b3a0',1139 ),1140 'symfony/http-client-contracts' => 1141 array (1142 'pretty_version' => 'v2.3.1',1143 'version' => '2.3.1.0',1144 'aliases' => 1145 array (1146 ),1147 'reference' => '41db680a15018f9c1d4b23516059633ce280ca33',1148 ),1149 'symfony/http-foundation' => 1150 array (1151 'pretty_version' => 'v5.1.8',1152 'version' => '5.1.8.0',1153 'aliases' => 1154 array (1155 ),1156 'reference' => 'a2860ec970404b0233ab1e59e0568d3277d32b6f',1157 ),1158 'symfony/http-kernel' => 1159 array (1160 'pretty_version' => 'v5.1.8',1161 'version' => '5.1.8.0',1162 'aliases' => 1163 array (1164 ),1165 'reference' => 'a13b3c4d994a4fd051f4c6800c5e33c9508091dd',1166 ),1167 'symfony/mime' => 1168 array (1169 'pretty_version' => 'v5.1.8',1170 'version' => '5.1.8.0',1171 'aliases' => 1172 array (1173 ),1174 'reference' => 'f5485a92c24d4bcfc2f3fc648744fb398482ff1b',1175 ),1176 'symfony/polyfill-ctype' => 1177 array (1178 'pretty_version' => 'v1.20.0',1179 'version' => '1.20.0.0',1180 'aliases' => 1181 array (1182 ),1183 'reference' => 'f4ba089a5b6366e453971d3aad5fe8e897b37f41',1184 ),1185 'symfony/polyfill-iconv' => 1186 array (1187 'pretty_version' => 'v1.20.0',1188 'version' => '1.20.0.0',1189 'aliases' => 1190 array (1191 ),1192 'reference' => 'c536646fdb4f29104dd26effc2fdcb9a5b085024',1193 ),1194 'symfony/polyfill-intl-grapheme' => 1195 array (1196 'pretty_version' => 'v1.20.0',1197 'version' => '1.20.0.0',1198 'aliases' => 1199 array (1200 ),1201 'reference' => 'c7cf3f858ec7d70b89559d6e6eb1f7c2517d479c',1202 ),1203 'symfony/polyfill-intl-idn' => 1204 array (1205 'pretty_version' => 'v1.20.0',1206 'version' => '1.20.0.0',1207 'aliases' => 1208 array (1209 ),1210 'reference' => '3b75acd829741c768bc8b1f84eb33265e7cc5117',1211 ),1212 'symfony/polyfill-intl-normalizer' => 1213 array (1214 'pretty_version' => 'v1.20.0',1215 'version' => '1.20.0.0',1216 'aliases' => 1217 array (1218 ),1219 'reference' => '727d1096295d807c309fb01a851577302394c897',1220 ),1221 'symfony/polyfill-mbstring' => 1222 array (1223 'pretty_version' => 'v1.20.0',1224 'version' => '1.20.0.0',1225 'aliases' => 1226 array (1227 ),1228 'reference' => '39d483bdf39be819deabf04ec872eb0b2410b531',1229 ),1230 'symfony/polyfill-php72' => 1231 array (1232 'pretty_version' => 'v1.20.0',1233 'version' => '1.20.0.0',1234 'aliases' => 1235 array (1236 ),1237 'reference' => 'cede45fcdfabdd6043b3592e83678e42ec69e930',1238 ),1239 'symfony/polyfill-php73' => 1240 array (1241 'pretty_version' => 'v1.20.0',1242 'version' => '1.20.0.0',1243 'aliases' => 1244 array (1245 ),1246 'reference' => '8ff431c517be11c78c48a39a66d37431e26a6bed',1247 ),1248 'symfony/polyfill-php80' => 1249 array (1250 'pretty_version' => 'v1.20.0',1251 'version' => '1.20.0.0',1252 'aliases' => 1253 array (1254 ),1255 'reference' => 'e70aa8b064c5b72d3df2abd5ab1e90464ad009de',1256 ),1257 'symfony/process' => 1258 array (1259 'pretty_version' => 'v5.1.8',1260 'version' => '5.1.8.0',1261 'aliases' => 1262 array (1263 ),1264 'reference' => 'f00872c3f6804150d6a0f73b4151daab96248101',1265 ),1266 'symfony/routing' => 1267 array (1268 'pretty_version' => 'v5.1.8',1269 'version' => '5.1.8.0',1270 'aliases' => 1271 array (1272 ),1273 'reference' => 'd6ceee2a37b61b41079005207bf37746d1bfe71f',1274 ),1275 'symfony/service-contracts' => 1276 array (1277 'pretty_version' => 'v2.2.0',1278 'version' => '2.2.0.0',1279 'aliases' => 1280 array (1281 ),1282 'reference' => 'd15da7ba4957ffb8f1747218be9e1a121fd298a1',1283 ),1284 'symfony/string' => 1285 array (1286 'pretty_version' => 'v5.1.8',1287 'version' => '5.1.8.0',1288 'aliases' => 1289 array (1290 ),1291 'reference' => 'a97573e960303db71be0dd8fda9be3bca5e0feea',1292 ),1293 'symfony/translation' => 1294 array (1295 'pretty_version' => 'v5.1.8',1296 'version' => '5.1.8.0',1297 'aliases' => 1298 array (1299 ),1300 'reference' => '27980838fd261e04379fa91e94e81e662fe5a1b6',1301 ),1302 'symfony/translation-contracts' => 1303 array (1304 'pretty_version' => 'v2.3.0',1305 'version' => '2.3.0.0',1306 'aliases' => 1307 array (1308 ),1309 'reference' => 'e2eaa60b558f26a4b0354e1bbb25636efaaad105',1310 ),1311 'symfony/translation-implementation' => 1312 array (1313 'provided' => 1314 array (1315 0 => '2.0',1316 ),1317 ),1318 'symfony/var-dumper' => 1319 array (1320 'pretty_version' => 'v5.1.8',1321 'version' => '5.1.8.0',1322 'aliases' => 1323 array (1324 ),1325 'reference' => '4e13f3fcefb1fcaaa5efb5403581406f4e840b9a',1326 ),1327 'tcg/voyager' => 1328 array (1329 'pretty_version' => '1.x-dev',1330 'version' => '1.9999999.9999999.9999999-dev',1331 'aliases' => 1332 array (1333 ),1334 'reference' => '5753a2c39fba82a8a10497efa2d38c2bb213103f',1335 ),1336 'theseer/tokenizer' => 1337 array (1338 'pretty_version' => '1.2.0',1339 'version' => '1.2.0.0',1340 'aliases' => 1341 array (1342 ),1343 'reference' => '75a63c33a8577608444246075ea0af0d052e452a',1344 ),1345 'tijsverkoyen/css-to-inline-styles' => 1346 array (1347 'pretty_version' => '2.2.3',1348 'version' => '2.2.3.0',1349 'aliases' => 1350 array (1351 ),1352 'reference' => 'b43b05cf43c1b6d849478965062b6ef73e223bb5',1353 ),1354 'vlucas/phpdotenv' => 1355 array (1356 'pretty_version' => 'v4.1.8',1357 'version' => '4.1.8.0',1358 'aliases' => 1359 array (1360 ),1361 'reference' => '572af79d913627a9d70374d27a6f5d689a35de32',1362 ),1363 'voku/portable-ascii' => 1364 array (1365 'pretty_version' => '1.5.6',1366 'version' => '1.5.6.0',1367 'aliases' => 1368 array (1369 ),1370 'reference' => '80953678b19901e5165c56752d087fc11526017c',1371 ),1372 'webmozart/assert' => 1373 array (1374 'pretty_version' => '1.9.1',1375 'version' => '1.9.1.0',1376 'aliases' => 1377 array (1378 ),1379 'reference' => 'bafc69caeb4d49c39fd0779086c03a3738cbb389',1380 ),1381 ),1382);...
restmapper_test.go
Source:restmapper_test.go
...15 "errors"16 "reflect"17 "strings"18 "testing"19 "k8s.io/kubernetes/pkg/api/unversioned"20 "k8s.io/kubernetes/pkg/runtime"21)22type fakeConvertor struct{}23func (fakeConvertor) Convert(in, out, context interface{}) error {24 return nil25}26func (fakeConvertor) ConvertToVersion(in runtime.Object, _ runtime.GroupVersioner) (runtime.Object, error) {27 return in, nil28}29func (fakeConvertor) ConvertFieldLabel(version, kind, label, value string) (string, string, error) {30 return label, value, nil31}32var validAccessor = resourceAccessor{}33var validConvertor = fakeConvertor{}34func fakeInterfaces(version unversioned.GroupVersion) (*VersionInterfaces, error) {35 return &VersionInterfaces{ObjectConvertor: validConvertor, MetadataAccessor: validAccessor}, nil36}37var unmatchedErr = errors.New("no version")38func unmatchedVersionInterfaces(version unversioned.GroupVersion) (*VersionInterfaces, error) {39 return nil, unmatchedErr40}41func TestRESTMapperVersionAndKindForResource(t *testing.T) {42 testGroup := "test.group"43 testVersion := "test"44 testGroupVersion := unversioned.GroupVersion{Group: testGroup, Version: testVersion}45 testCases := []struct {46 Resource unversioned.GroupVersionResource47 GroupVersionToRegister unversioned.GroupVersion48 ExpectedGVK unversioned.GroupVersionKind49 Err bool50 }{51 {Resource: unversioned.GroupVersionResource{Resource: "internalobjec"}, Err: true},52 {Resource: unversioned.GroupVersionResource{Resource: "internalObjec"}, Err: true},53 {Resource: unversioned.GroupVersionResource{Resource: "internalobject"}, ExpectedGVK: testGroupVersion.WithKind("InternalObject")},54 {Resource: unversioned.GroupVersionResource{Resource: "internalobjects"}, ExpectedGVK: testGroupVersion.WithKind("InternalObject")},55 }56 for i, testCase := range testCases {57 mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{testGroupVersion}, fakeInterfaces)58 if len(testCase.ExpectedGVK.Kind) != 0 {59 mapper.Add(testCase.ExpectedGVK, RESTScopeNamespace)60 }61 actualGVK, err := mapper.KindFor(testCase.Resource)62 hasErr := err != nil63 if hasErr != testCase.Err {64 t.Errorf("%d: unexpected error behavior %t: %v", i, testCase.Err, err)65 continue66 }67 if err != nil {68 continue69 }70 if actualGVK != testCase.ExpectedGVK {71 t.Errorf("%d: unexpected version and kind: e=%s a=%s", i, testCase.ExpectedGVK, actualGVK)72 }73 }74}75func TestRESTMapperGroupForResource(t *testing.T) {76 testCases := []struct {77 Resource unversioned.GroupVersionResource78 GroupVersionKind unversioned.GroupVersionKind79 Err bool80 }{81 {Resource: unversioned.GroupVersionResource{Resource: "myObject"}, GroupVersionKind: unversioned.GroupVersionKind{Group: "testapi", Version: "test", Kind: "MyObject"}},82 {Resource: unversioned.GroupVersionResource{Resource: "myobject"}, GroupVersionKind: unversioned.GroupVersionKind{Group: "testapi2", Version: "test", Kind: "MyObject"}},83 {Resource: unversioned.GroupVersionResource{Resource: "myObje"}, Err: true, GroupVersionKind: unversioned.GroupVersionKind{Group: "testapi", Version: "test", Kind: "MyObject"}},84 {Resource: unversioned.GroupVersionResource{Resource: "myobje"}, Err: true, GroupVersionKind: unversioned.GroupVersionKind{Group: "testapi", Version: "test", Kind: "MyObject"}},85 }86 for i, testCase := range testCases {87 mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{testCase.GroupVersionKind.GroupVersion()}, fakeInterfaces)88 mapper.Add(testCase.GroupVersionKind, RESTScopeNamespace)89 actualGVK, err := mapper.KindFor(testCase.Resource)90 if testCase.Err {91 if err == nil {92 t.Errorf("%d: expected error", i)93 }94 } else if err != nil {95 t.Errorf("%d: unexpected error: %v", i, err)96 } else if actualGVK != testCase.GroupVersionKind {97 t.Errorf("%d: expected group %q, got %q", i, testCase.GroupVersionKind, actualGVK)98 }99 }100}101func TestRESTMapperKindsFor(t *testing.T) {102 testCases := []struct {103 Name string104 PreferredOrder []unversioned.GroupVersion105 KindsToRegister []unversioned.GroupVersionKind106 PartialResourceToRequest unversioned.GroupVersionResource107 ExpectedKinds []unversioned.GroupVersionKind108 ExpectedKindErr string109 }{110 {111 // exact matches are prefered112 Name: "groups, with group exact",113 PreferredOrder: []unversioned.GroupVersion{114 {Group: "first-group-1", Version: "first-version"},115 {Group: "first-group", Version: "first-version"},116 },117 KindsToRegister: []unversioned.GroupVersionKind{118 {Group: "first-group-1", Version: "first-version", Kind: "my-kind"},119 {Group: "first-group", Version: "first-version", Kind: "my-kind"},120 },121 PartialResourceToRequest: unversioned.GroupVersionResource{Group: "first-group", Resource: "my-kind"},122 ExpectedKinds: []unversioned.GroupVersionKind{123 {Group: "first-group", Version: "first-version", Kind: "my-kind"},124 },125 },126 {127 // group prefixes work128 Name: "groups, with group prefix",129 PreferredOrder: []unversioned.GroupVersion{130 {Group: "second-group", Version: "first-version"},131 {Group: "first-group", Version: "first-version"},132 },133 KindsToRegister: []unversioned.GroupVersionKind{134 {Group: "first-group", Version: "first-version", Kind: "my-kind"},135 {Group: "second-group", Version: "first-version", Kind: "my-kind"},136 },137 PartialResourceToRequest: unversioned.GroupVersionResource{Group: "first", Resource: "my-kind"},138 ExpectedKinds: []unversioned.GroupVersionKind{139 {Group: "first-group", Version: "first-version", Kind: "my-kind"},140 },141 },142 {143 // group prefixes can be ambiguous144 Name: "groups, with ambiguous group prefix",145 PreferredOrder: []unversioned.GroupVersion{146 {Group: "first-group-1", Version: "first-version"},147 {Group: "first-group", Version: "first-version"},148 },149 KindsToRegister: []unversioned.GroupVersionKind{150 {Group: "first-group-1", Version: "first-version", Kind: "my-kind"},151 {Group: "first-group", Version: "first-version", Kind: "my-kind"},152 },153 PartialResourceToRequest: unversioned.GroupVersionResource{Group: "first", Resource: "my-kind"},154 ExpectedKinds: []unversioned.GroupVersionKind{155 {Group: "first-group-1", Version: "first-version", Kind: "my-kind"},156 {Group: "first-group", Version: "first-version", Kind: "my-kind"},157 },158 ExpectedKindErr: " matches multiple kinds ",159 },160 {161 Name: "ambiguous groups, with preference order",162 PreferredOrder: []unversioned.GroupVersion{163 {Group: "second-group", Version: "first-version"},164 {Group: "first-group", Version: "first-version"},165 },166 KindsToRegister: []unversioned.GroupVersionKind{167 {Group: "first-group", Version: "first-version", Kind: "my-kind"},168 {Group: "first-group", Version: "first-version", Kind: "your-kind"},169 {Group: "second-group", Version: "first-version", Kind: "my-kind"},170 {Group: "second-group", Version: "first-version", Kind: "your-kind"},171 },172 PartialResourceToRequest: unversioned.GroupVersionResource{Resource: "my-kinds"},173 ExpectedKinds: []unversioned.GroupVersionKind{174 {Group: "second-group", Version: "first-version", Kind: "my-kind"},175 {Group: "first-group", Version: "first-version", Kind: "my-kind"},176 },177 ExpectedKindErr: " matches multiple kinds ",178 },179 {180 Name: "ambiguous groups, with explicit group match",181 PreferredOrder: []unversioned.GroupVersion{182 {Group: "second-group", Version: "first-version"},183 {Group: "first-group", Version: "first-version"},184 },185 KindsToRegister: []unversioned.GroupVersionKind{186 {Group: "first-group", Version: "first-version", Kind: "my-kind"},187 {Group: "first-group", Version: "first-version", Kind: "your-kind"},188 {Group: "second-group", Version: "first-version", Kind: "my-kind"},189 {Group: "second-group", Version: "first-version", Kind: "your-kind"},190 },191 PartialResourceToRequest: unversioned.GroupVersionResource{Group: "first-group", Resource: "my-kinds"},192 ExpectedKinds: []unversioned.GroupVersionKind{193 {Group: "first-group", Version: "first-version", Kind: "my-kind"},194 },195 },196 {197 Name: "ambiguous groups, with ambiguous version match",198 PreferredOrder: []unversioned.GroupVersion{199 {Group: "first-group", Version: "first-version"},200 {Group: "second-group", Version: "first-version"},201 },202 KindsToRegister: []unversioned.GroupVersionKind{203 {Group: "first-group", Version: "first-version", Kind: "my-kind"},204 {Group: "first-group", Version: "first-version", Kind: "your-kind"},205 {Group: "second-group", Version: "first-version", Kind: "my-kind"},206 {Group: "second-group", Version: "first-version", Kind: "your-kind"},207 },208 PartialResourceToRequest: unversioned.GroupVersionResource{Version: "first-version", Resource: "my-kinds"},209 ExpectedKinds: []unversioned.GroupVersionKind{210 {Group: "first-group", Version: "first-version", Kind: "my-kind"},211 {Group: "second-group", Version: "first-version", Kind: "my-kind"},212 },213 ExpectedKindErr: " matches multiple kinds ",214 },215 }216 for _, testCase := range testCases {217 tcName := testCase.Name218 mapper := NewDefaultRESTMapper(testCase.PreferredOrder, fakeInterfaces)219 for _, kind := range testCase.KindsToRegister {220 mapper.Add(kind, RESTScopeNamespace)221 }222 actualKinds, err := mapper.KindsFor(testCase.PartialResourceToRequest)223 if err != nil {224 t.Errorf("%s: unexpected error: %v", tcName, err)225 continue226 }227 if !reflect.DeepEqual(testCase.ExpectedKinds, actualKinds) {228 t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedKinds, actualKinds)229 }230 singleKind, err := mapper.KindFor(testCase.PartialResourceToRequest)231 if err == nil && len(testCase.ExpectedKindErr) != 0 {232 t.Errorf("%s: expected error: %v", tcName, testCase.ExpectedKindErr)233 continue234 }235 if err != nil {236 if len(testCase.ExpectedKindErr) == 0 {237 t.Errorf("%s: unexpected error: %v", tcName, err)238 continue239 } else {240 if !strings.Contains(err.Error(), testCase.ExpectedKindErr) {241 t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedKindErr, err)242 continue243 }244 }245 } else {246 if testCase.ExpectedKinds[0] != singleKind {247 t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedKinds[0], singleKind)248 }249 }250 }251}252func TestRESTMapperResourcesFor(t *testing.T) {253 testCases := []struct {254 Name string255 PreferredOrder []unversioned.GroupVersion256 KindsToRegister []unversioned.GroupVersionKind257 PluralPartialResourceToRequest unversioned.GroupVersionResource258 SingularPartialResourceToRequest unversioned.GroupVersionResource259 ExpectedResources []unversioned.GroupVersionResource260 ExpectedResourceErr string261 }{262 {263 // exact matches are prefered264 Name: "groups, with group exact",265 PreferredOrder: []unversioned.GroupVersion{266 {Group: "first-group-1", Version: "first-version"},267 {Group: "first-group", Version: "first-version"},268 },269 KindsToRegister: []unversioned.GroupVersionKind{270 {Group: "first-group-1", Version: "first-version", Kind: "my-kind"},271 {Group: "first-group", Version: "first-version", Kind: "my-kind"},272 },273 PluralPartialResourceToRequest: unversioned.GroupVersionResource{Group: "first-group", Resource: "my-kinds"},274 SingularPartialResourceToRequest: unversioned.GroupVersionResource{Group: "first-group", Resource: "my-kind"},275 ExpectedResources: []unversioned.GroupVersionResource{276 {Group: "first-group", Version: "first-version", Resource: "my-kinds"},277 },278 },279 {280 // group prefixes work281 Name: "groups, with group prefix",282 PreferredOrder: []unversioned.GroupVersion{283 {Group: "second-group", Version: "first-version"},284 {Group: "first-group", Version: "first-version"},285 },286 KindsToRegister: []unversioned.GroupVersionKind{287 {Group: "first-group", Version: "first-version", Kind: "my-kind"},288 {Group: "second-group", Version: "first-version", Kind: "my-kind"},289 },290 PluralPartialResourceToRequest: unversioned.GroupVersionResource{Group: "first", Resource: "my-kinds"},291 SingularPartialResourceToRequest: unversioned.GroupVersionResource{Group: "first", Resource: "my-kind"},292 ExpectedResources: []unversioned.GroupVersionResource{293 {Group: "first-group", Version: "first-version", Resource: "my-kinds"},294 },295 },296 {297 // group prefixes can be ambiguous298 Name: "groups, with ambiguous group prefix",299 PreferredOrder: []unversioned.GroupVersion{300 {Group: "first-group-1", Version: "first-version"},301 {Group: "first-group", Version: "first-version"},302 },303 KindsToRegister: []unversioned.GroupVersionKind{304 {Group: "first-group-1", Version: "first-version", Kind: "my-kind"},305 {Group: "first-group", Version: "first-version", Kind: "my-kind"},306 },307 PluralPartialResourceToRequest: unversioned.GroupVersionResource{Group: "first", Resource: "my-kinds"},308 SingularPartialResourceToRequest: unversioned.GroupVersionResource{Group: "first", Resource: "my-kind"},309 ExpectedResources: []unversioned.GroupVersionResource{310 {Group: "first-group-1", Version: "first-version", Resource: "my-kinds"},311 {Group: "first-group", Version: "first-version", Resource: "my-kinds"},312 },313 ExpectedResourceErr: " matches multiple resources ",314 },315 {316 Name: "ambiguous groups, with preference order",317 PreferredOrder: []unversioned.GroupVersion{318 {Group: "second-group", Version: "first-version"},319 {Group: "first-group", Version: "first-version"},320 },321 KindsToRegister: []unversioned.GroupVersionKind{322 {Group: "first-group", Version: "first-version", Kind: "my-kind"},323 {Group: "first-group", Version: "first-version", Kind: "your-kind"},324 {Group: "second-group", Version: "first-version", Kind: "my-kind"},325 {Group: "second-group", Version: "first-version", Kind: "your-kind"},326 },327 PluralPartialResourceToRequest: unversioned.GroupVersionResource{Resource: "my-kinds"},328 SingularPartialResourceToRequest: unversioned.GroupVersionResource{Resource: "my-kind"},329 ExpectedResources: []unversioned.GroupVersionResource{330 {Group: "second-group", Version: "first-version", Resource: "my-kinds"},331 {Group: "first-group", Version: "first-version", Resource: "my-kinds"},332 },333 ExpectedResourceErr: " matches multiple resources ",334 },335 {336 Name: "ambiguous groups, with explicit group match",337 PreferredOrder: []unversioned.GroupVersion{338 {Group: "second-group", Version: "first-version"},339 {Group: "first-group", Version: "first-version"},340 },341 KindsToRegister: []unversioned.GroupVersionKind{342 {Group: "first-group", Version: "first-version", Kind: "my-kind"},343 {Group: "first-group", Version: "first-version", Kind: "your-kind"},344 {Group: "second-group", Version: "first-version", Kind: "my-kind"},345 {Group: "second-group", Version: "first-version", Kind: "your-kind"},346 },347 PluralPartialResourceToRequest: unversioned.GroupVersionResource{Group: "first-group", Resource: "my-kinds"},348 SingularPartialResourceToRequest: unversioned.GroupVersionResource{Group: "first-group", Resource: "my-kind"},349 ExpectedResources: []unversioned.GroupVersionResource{350 {Group: "first-group", Version: "first-version", Resource: "my-kinds"},351 },352 },353 {354 Name: "ambiguous groups, with ambiguous version match",355 PreferredOrder: []unversioned.GroupVersion{356 {Group: "first-group", Version: "first-version"},357 {Group: "second-group", Version: "first-version"},358 },359 KindsToRegister: []unversioned.GroupVersionKind{360 {Group: "first-group", Version: "first-version", Kind: "my-kind"},361 {Group: "first-group", Version: "first-version", Kind: "your-kind"},362 {Group: "second-group", Version: "first-version", Kind: "my-kind"},363 {Group: "second-group", Version: "first-version", Kind: "your-kind"},364 },365 PluralPartialResourceToRequest: unversioned.GroupVersionResource{Version: "first-version", Resource: "my-kinds"},366 SingularPartialResourceToRequest: unversioned.GroupVersionResource{Version: "first-version", Resource: "my-kind"},367 ExpectedResources: []unversioned.GroupVersionResource{368 {Group: "first-group", Version: "first-version", Resource: "my-kinds"},369 {Group: "second-group", Version: "first-version", Resource: "my-kinds"},370 },371 ExpectedResourceErr: " matches multiple resources ",372 },373 }374 for _, testCase := range testCases {375 tcName := testCase.Name376 for _, partialResource := range []unversioned.GroupVersionResource{testCase.PluralPartialResourceToRequest, testCase.SingularPartialResourceToRequest} {377 mapper := NewDefaultRESTMapper(testCase.PreferredOrder, fakeInterfaces)378 for _, kind := range testCase.KindsToRegister {379 mapper.Add(kind, RESTScopeNamespace)380 }381 actualResources, err := mapper.ResourcesFor(partialResource)382 if err != nil {383 t.Errorf("%s: unexpected error: %v", tcName, err)384 continue385 }386 if !reflect.DeepEqual(testCase.ExpectedResources, actualResources) {387 t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedResources, actualResources)388 }389 singleResource, err := mapper.ResourceFor(partialResource)390 if err == nil && len(testCase.ExpectedResourceErr) != 0 {391 t.Errorf("%s: expected error: %v", tcName, testCase.ExpectedResourceErr)392 continue393 }394 if err != nil {395 if len(testCase.ExpectedResourceErr) == 0 {396 t.Errorf("%s: unexpected error: %v", tcName, err)397 continue398 } else {399 if !strings.Contains(err.Error(), testCase.ExpectedResourceErr) {400 t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedResourceErr, err)401 continue402 }403 }404 } else {405 if testCase.ExpectedResources[0] != singleResource {406 t.Errorf("%s: expected %v, got %v", tcName, testCase.ExpectedResources[0], singleResource)407 }408 }409 }410 }411}412func TestKindToResource(t *testing.T) {413 testCases := []struct {414 Kind string415 Plural, Singular string416 }{417 {Kind: "Pod", Plural: "pods", Singular: "pod"},418 {Kind: "ReplicationController", Plural: "replicationcontrollers", Singular: "replicationcontroller"},419 // Add "ies" when ending with "y"420 {Kind: "ImageRepository", Plural: "imagerepositories", Singular: "imagerepository"},421 // Add "es" when ending with "s"422 {Kind: "miss", Plural: "misses", Singular: "miss"},423 // Add "s" otherwise424 {Kind: "lowercase", Plural: "lowercases", Singular: "lowercase"},425 }426 for i, testCase := range testCases {427 version := unversioned.GroupVersion{}428 plural, singular := KindToResource(version.WithKind(testCase.Kind))429 if singular != version.WithResource(testCase.Singular) || plural != version.WithResource(testCase.Plural) {430 t.Errorf("%d: unexpected plural and singular: %v %v", i, plural, singular)431 }432 }433}434func TestRESTMapperResourceSingularizer(t *testing.T) {435 testGroupVersion := unversioned.GroupVersion{Group: "tgroup", Version: "test"}436 testCases := []struct {437 Kind string438 Plural string439 Singular string440 }{441 {Kind: "Pod", Plural: "pods", Singular: "pod"},442 {Kind: "ReplicationController", Plural: "replicationcontrollers", Singular: "replicationcontroller"},443 {Kind: "ImageRepository", Plural: "imagerepositories", Singular: "imagerepository"},444 {Kind: "Status", Plural: "statuses", Singular: "status"},445 {Kind: "lowercase", Plural: "lowercases", Singular: "lowercase"},446 // TODO this test is broken. This updates to reflect actual behavior. Kinds are expected to be singular447 // old (incorrect), coment: Don't add extra s if the original object is already plural448 {Kind: "lowercases", Plural: "lowercaseses", Singular: "lowercases"},449 }450 for i, testCase := range testCases {451 mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{testGroupVersion}, fakeInterfaces)452 // create singular/plural mapping453 mapper.Add(testGroupVersion.WithKind(testCase.Kind), RESTScopeNamespace)454 singular, err := mapper.ResourceSingularizer(testCase.Plural)455 if err != nil {456 t.Errorf("%d: unexpected error: %v", i, err)457 }458 if singular != testCase.Singular {459 t.Errorf("%d: mismatched singular: got %v, expected %v", i, singular, testCase.Singular)460 }461 }462}463func TestRESTMapperRESTMapping(t *testing.T) {464 testGroup := "tgroup"465 testGroupVersion := unversioned.GroupVersion{Group: testGroup, Version: "test"}466 internalGroupVersion := unversioned.GroupVersion{Group: testGroup, Version: "test"}467 testCases := []struct {468 Kind string469 APIGroupVersions []unversioned.GroupVersion470 DefaultVersions []unversioned.GroupVersion471 Resource string472 ExpectedGroupVersion *unversioned.GroupVersion473 Err bool474 }{475 {Kind: "Unknown", Err: true},476 {Kind: "InternalObject", Err: true},477 {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "Unknown", Err: true},478 {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []unversioned.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: "internalobjects"},479 {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []unversioned.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: "internalobjects"},480 {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []unversioned.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: "internalobjects"},481 {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []unversioned.GroupVersion{}, Resource: "internalobjects", ExpectedGroupVersion: &unversioned.GroupVersion{Group: testGroup, Version: "test"}},482 {DefaultVersions: []unversioned.GroupVersion{testGroupVersion}, Kind: "InternalObject", APIGroupVersions: []unversioned.GroupVersion{{Group: testGroup, Version: "test"}}, Resource: "internalobjects"},483 // TODO: add test for a resource that exists in one version but not another484 }485 for i, testCase := range testCases {486 mapper := NewDefaultRESTMapper(testCase.DefaultVersions, fakeInterfaces)487 mapper.Add(internalGroupVersion.WithKind("InternalObject"), RESTScopeNamespace)488 preferredVersions := []string{}489 for _, gv := range testCase.APIGroupVersions {490 preferredVersions = append(preferredVersions, gv.Version)491 }492 gk := unversioned.GroupKind{Group: testGroup, Kind: testCase.Kind}493 mapping, err := mapper.RESTMapping(gk, preferredVersions...)494 hasErr := err != nil495 if hasErr != testCase.Err {496 t.Errorf("%d: unexpected error behavior %t: %v", i, testCase.Err, err)497 }498 if hasErr {499 continue500 }501 if mapping.Resource != testCase.Resource {502 t.Errorf("%d: unexpected resource: %#v", i, mapping)503 }504 if mapping.MetadataAccessor == nil || mapping.ObjectConvertor == nil {505 t.Errorf("%d: missing codec and accessor: %#v", i, mapping)506 }507 groupVersion := testCase.ExpectedGroupVersion508 if groupVersion == nil {509 groupVersion = &testCase.APIGroupVersions[0]510 }511 if mapping.GroupVersionKind.GroupVersion() != *groupVersion {512 t.Errorf("%d: unexpected version: %#v", i, mapping)513 }514 }515}516func TestRESTMapperRESTMappingSelectsVersion(t *testing.T) {517 expectedGroupVersion1 := unversioned.GroupVersion{Group: "tgroup", Version: "test1"}518 expectedGroupVersion2 := unversioned.GroupVersion{Group: "tgroup", Version: "test2"}519 expectedGroupVersion3 := unversioned.GroupVersion{Group: "tgroup", Version: "test3"}520 internalObjectGK := unversioned.GroupKind{Group: "tgroup", Kind: "InternalObject"}521 otherObjectGK := unversioned.GroupKind{Group: "tgroup", Kind: "OtherObject"}522 mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{expectedGroupVersion1, expectedGroupVersion2}, fakeInterfaces)523 mapper.Add(expectedGroupVersion1.WithKind("InternalObject"), RESTScopeNamespace)524 mapper.Add(expectedGroupVersion2.WithKind("OtherObject"), RESTScopeNamespace)525 // pick default matching object kind based on search order526 mapping, err := mapper.RESTMapping(otherObjectGK)527 if err != nil {528 t.Fatalf("unexpected error: %v", err)529 }530 if mapping.Resource != "otherobjects" || mapping.GroupVersionKind.GroupVersion() != expectedGroupVersion2 {531 t.Errorf("unexpected mapping: %#v", mapping)532 }533 mapping, err = mapper.RESTMapping(internalObjectGK)534 if err != nil {535 t.Fatalf("unexpected error: %v", err)536 }537 if mapping.Resource != "internalobjects" || mapping.GroupVersionKind.GroupVersion() != expectedGroupVersion1 {538 t.Errorf("unexpected mapping: %#v", mapping)539 }540 // mismatch of version541 mapping, err = mapper.RESTMapping(internalObjectGK, expectedGroupVersion2.Version)542 if err == nil {543 t.Errorf("unexpected non-error")544 }545 mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion1.Version)546 if err == nil {547 t.Errorf("unexpected non-error")548 }549 // not in the search versions550 mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version)551 if err == nil {552 t.Errorf("unexpected non-error")553 }554 // explicit search order555 mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version, expectedGroupVersion1.Version)556 if err == nil {557 t.Errorf("unexpected non-error")558 }559 mapping, err = mapper.RESTMapping(otherObjectGK, expectedGroupVersion3.Version, expectedGroupVersion2.Version)560 if err != nil {561 t.Fatalf("unexpected error: %v", err)562 }563 if mapping.Resource != "otherobjects" || mapping.GroupVersionKind.GroupVersion() != expectedGroupVersion2 {564 t.Errorf("unexpected mapping: %#v", mapping)565 }566}567func TestRESTMapperReportsErrorOnBadVersion(t *testing.T) {568 expectedGroupVersion1 := unversioned.GroupVersion{Group: "tgroup", Version: "test1"}569 expectedGroupVersion2 := unversioned.GroupVersion{Group: "tgroup", Version: "test2"}570 internalObjectGK := unversioned.GroupKind{Group: "tgroup", Kind: "InternalObject"}571 mapper := NewDefaultRESTMapper([]unversioned.GroupVersion{expectedGroupVersion1, expectedGroupVersion2}, unmatchedVersionInterfaces)572 mapper.Add(expectedGroupVersion1.WithKind("InternalObject"), RESTScopeNamespace)573 _, err := mapper.RESTMapping(internalObjectGK, expectedGroupVersion1.Version)574 if err == nil {575 t.Errorf("unexpected non-error")576 }577}...
VersionGuesser.php
Source:VersionGuesser.php
...17use Composer\Util\HttpDownloader;18use Composer\Util\ProcessExecutor;19use Composer\Util\Svn as SvnUtil;20/**21 * Try to guess the current version number based on different VCS configuration.22 *23 * @author Jordi Boggiano <j.boggiano@seld.be>24 * @author Samuel Roze <samuel.roze@gmail.com>25 */26class VersionGuesser27{28 /**29 * @var Config30 */31 private $config;32 /**33 * @var ProcessExecutor34 */35 private $process;36 /**37 * @var SemverVersionParser38 */39 private $versionParser;40 /**41 * @param Config $config42 * @param ProcessExecutor $process43 * @param SemverVersionParser $versionParser44 */45 public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)46 {47 $this->config = $config;48 $this->process = $process;49 $this->versionParser = $versionParser;50 }51 /**52 * @param array $packageConfig53 * @param string $path Path to guess into54 *55 * @return null|array versionData, 'version', 'pretty_version' and 'commit' keys, if the version is a feature branch, 'feature_version' and 'feature_pretty_version' keys may also be returned56 */57 public function guessVersion(array $packageConfig, $path)58 {59 if (!function_exists('proc_open')) {60 return null;61 }62 $versionData = $this->guessGitVersion($packageConfig, $path);63 if (null !== $versionData && null !== $versionData['version']) {64 return $this->postprocess($versionData);65 }66 $versionData = $this->guessHgVersion($packageConfig, $path);67 if (null !== $versionData && null !== $versionData['version']) {68 return $this->postprocess($versionData);69 }70 $versionData = $this->guessFossilVersion($path);71 if (null !== $versionData && null !== $versionData['version']) {72 return $this->postprocess($versionData);73 }74 $versionData = $this->guessSvnVersion($packageConfig, $path);75 if (null !== $versionData && null !== $versionData['version']) {76 return $this->postprocess($versionData);77 }78 return null;79 }80 private function postprocess(array $versionData)81 {82 if (!empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['pretty_version']) {83 unset($versionData['feature_version'], $versionData['feature_pretty_version']);84 }85 if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {86 $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);87 }88 if (!empty($versionData['feature_version']) && '-dev' === substr($versionData['feature_version'], -4) && preg_match('{\.9{7}}', $versionData['feature_version'])) {89 $versionData['feature_pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['feature_version']);90 }91 return $versionData;92 }93 private function guessGitVersion(array $packageConfig, $path)94 {95 GitUtil::cleanEnv();96 $commit = null;97 $version = null;98 $prettyVersion = null;99 $featureVersion = null;100 $featurePrettyVersion = null;101 $isDetached = false;102 // try to fetch current version from git branch103 if (0 === $this->process->execute('git branch -a --no-color --no-abbrev -v', $output, $path)) {104 $branches = array();105 $isFeatureBranch = false;106 // find current branch and collect all branch names107 foreach ($this->process->splitLines($output) as $branch) {108 if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {109 if (110 $match[1] === '(no branch)'111 || strpos($match[1], '(detached ') === 0112 || strpos($match[1], '(HEAD detached at') === 0113 ) {114 $version = 'dev-' . $match[2];115 $prettyVersion = $version;116 $isFeatureBranch = true;117 $isDetached = true;118 } else {119 $version = $this->versionParser->normalizeBranch($match[1]);120 $prettyVersion = 'dev-' . $match[1];121 $isFeatureBranch = $this->isFeatureBranch($packageConfig, $match[1]);122 }123 if ($match[2]) {124 $commit = $match[2];125 }126 }127 if ($branch && !preg_match('{^ *.+/HEAD }', $branch)) {128 if (preg_match('{^(?:\* )? *((?:remotes/(?:origin|upstream)/)?[^\s/]+) *([a-f0-9]+) .*$}', $branch, $match)) {129 $branches[] = $match[1];130 }131 }132 }133 if ($isFeatureBranch) {134 $featureVersion = $version;135 $featurePrettyVersion = $prettyVersion;136 // try to find the best (nearest) version branch to assume this feature's version137 $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);138 $version = $result['version'];139 $prettyVersion = $result['pretty_version'];140 }141 }142 if (!$version || $isDetached) {143 $result = $this->versionFromGitTags($path);144 if ($result) {145 $version = $result['version'];146 $prettyVersion = $result['pretty_version'];147 $featureVersion = null;148 $featurePrettyVersion = null;149 }150 }151 if (!$commit) {152 $command = 'git log --pretty="%H" -n1 HEAD'.GitUtil::getNoShowSignatureFlag($this->process);153 if (0 === $this->process->execute($command, $output, $path)) {154 $commit = trim($output) ?: null;155 }156 }157 if ($featureVersion) {158 return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion, 'feature_version' => $featureVersion, 'feature_pretty_version' => $featurePrettyVersion);159 }160 return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);161 }162 private function versionFromGitTags($path)163 {164 // try to fetch current version from git tags165 if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {166 try {167 $version = $this->versionParser->normalize(trim($output));168 return array('version' => $version, 'pretty_version' => trim($output));169 } catch (\Exception $e) {170 }171 }172 return null;173 }174 private function guessHgVersion(array $packageConfig, $path)175 {176 // try to fetch current version from hg branch177 if (0 === $this->process->execute('hg branch', $output, $path)) {178 $branch = trim($output);179 $version = $this->versionParser->normalizeBranch($branch);180 $isFeatureBranch = 0 === strpos($version, 'dev-');181 if (VersionParser::DEFAULT_BRANCH_ALIAS === $version) {182 return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);183 }184 if (!$isFeatureBranch) {185 return array('version' => $version, 'commit' => null, 'pretty_version' => $version);186 }187 // re-use the HgDriver to fetch branches (this properly includes bookmarks)188 $io = new NullIO();189 $driver = new HgDriver(array('url' => $path), $io, $this->config, new HttpDownloader($io, $this->config), $this->process);190 $branches = array_keys($driver->getBranches());191 // try to find the best (nearest) version branch to assume this feature's version192 $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);193 $result['commit'] = '';194 $result['feature_version'] = $version;195 $result['feature_pretty_version'] = $version;196 return $result;197 }198 }199 private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)200 {201 $prettyVersion = $version;202 // ignore feature branches if they have no branch-alias or self.version is used203 // and find the branch they came from to use as a version instead204 if (!isset($packageConfig['extra']['branch-alias'][$version])205 || strpos(json_encode($packageConfig), '"self.version"')206 ) {207 $branch = preg_replace('{^dev-}', '', $version);208 $length = PHP_INT_MAX;209 // return directly, if branch is configured to be non-feature branch210 if (!$this->isFeatureBranch($packageConfig, $branch)) {211 return array('version' => $version, 'pretty_version' => $prettyVersion);212 }213 // sort local branches first then remote ones214 // and sort numeric branches below named ones, to make sure if the branch has the same distance from main and 1.10 and 1.9 for example, main is picked215 // and sort using natural sort so that 1.10 will appear before 1.9216 usort($branches, function ($a, $b) {217 $aRemote = 0 === strpos($a, 'remotes/');218 $bRemote = 0 === strpos($b, 'remotes/');219 if ($aRemote !== $bRemote) {220 return $aRemote ? 1 : -1;221 }222 return strnatcasecmp($b, $a);223 });224 foreach ($branches as $candidate) {225 $candidateVersion = preg_replace('{^remotes/\S+/}', '', $candidate);226 // do not compare against itself or other feature branches227 if ($candidate === $branch || $this->isFeatureBranch($packageConfig, $candidateVersion)) {228 continue;229 }230 $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);231 if (0 !== $this->process->execute($cmdLine, $output, $path)) {232 continue;233 }234 if (strlen($output) < $length) {235 $length = strlen($output);236 $version = $this->versionParser->normalizeBranch($candidateVersion);237 $prettyVersion = 'dev-' . $candidateVersion;238 if ($length === 0) {239 break;240 }241 }242 }243 }244 return array('version' => $version, 'pretty_version' => $prettyVersion);245 }246 private function isFeatureBranch(array $packageConfig, $branchName)247 {248 $nonFeatureBranches = '';249 if (!empty($packageConfig['non-feature-branches'])) {250 $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);251 }252 return !preg_match('{^(' . $nonFeatureBranches . '|master|main|latest|next|current|support|tip|trunk|default|develop|\d+\..+)$}', $branchName, $match);253 }254 private function guessFossilVersion($path)255 {256 $version = null;257 $prettyVersion = null;258 // try to fetch current version from fossil259 if (0 === $this->process->execute('fossil branch list', $output, $path)) {260 $branch = trim($output);261 $version = $this->versionParser->normalizeBranch($branch);262 $prettyVersion = 'dev-' . $branch;263 }264 // try to fetch current version from fossil tags265 if (0 === $this->process->execute('fossil tag list', $output, $path)) {266 try {267 $version = $this->versionParser->normalize(trim($output));268 $prettyVersion = trim($output);269 } catch (\Exception $e) {270 }271 }272 return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);273 }274 private function guessSvnVersion(array $packageConfig, $path)275 {276 SvnUtil::cleanEnv();277 // try to fetch current version from svn278 if (0 === $this->process->execute('svn info --xml', $output, $path)) {279 $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';280 $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';281 $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';282 $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';283 if (preg_match($urlPattern, $output, $matches)) {284 if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {285 // we are in a branches path286 $version = $this->versionParser->normalizeBranch($matches[3]);287 $prettyVersion = 'dev-' . $matches[3];288 return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);289 }290 $prettyVersion = trim($matches[1]);291 if ($prettyVersion === 'trunk') {292 $version = 'dev-trunk';293 } else {294 $version = $this->versionParser->normalize($prettyVersion);295 }296 return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);297 }298 }299 }300}...
register.go
Source:register.go
...22//23// ----------------------------------------------------------------------------24// *** DISCLAIMER ***25// Config Connector's go-client for CRDs is currently in ALPHA, which means26// that future versions of the go-client may include breaking changes.27// Please try it out and give us feedback!28// Package v1beta1 contains API Schema definitions for the compute v1beta1 API group.29// +k8s:openapi-gen=true30// +k8s:deepcopy-gen=package,register31// +k8s:conversion-gen=github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/pkg/apis/compute32// +k8s:defaulter-gen=TypeMeta33// +groupName=compute.cnrm.cloud.google.com34package v1beta135import (36 "reflect"37 "k8s.io/apimachinery/pkg/runtime/schema"38 "sigs.k8s.io/controller-runtime/pkg/scheme"39)40var (41 // SchemeGroupVersion is the group version used to register these objects.42 SchemeGroupVersion = schema.GroupVersion{Group: "compute.cnrm.cloud.google.com", Version: "v1beta1"}43 // SchemeBuilder is used to add go types to the GroupVersionKind scheme.44 SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}45 // AddToScheme is a global function that registers this API group & version to a scheme46 AddToScheme = SchemeBuilder.AddToScheme47 ComputeAddressGVK = schema.GroupVersionKind{48 Group: SchemeGroupVersion.Group,49 Version: SchemeGroupVersion.Version,50 Kind: reflect.TypeOf(ComputeAddress{}).Name(),51 }52 ComputeBackendBucketGVK = schema.GroupVersionKind{53 Group: SchemeGroupVersion.Group,54 Version: SchemeGroupVersion.Version,55 Kind: reflect.TypeOf(ComputeBackendBucket{}).Name(),56 }57 ComputeBackendServiceGVK = schema.GroupVersionKind{58 Group: SchemeGroupVersion.Group,59 Version: SchemeGroupVersion.Version,...
version.go
Source:version.go
...3 "strings"4 sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"5)6var (7 // DefaultIBCVersion represents the latest supported version of IBC used8 // in connection version negotiation. The current version supports only9 // ORDERED and UNORDERED channels and requires at least one channel type10 // to be agreed upon.11 DefaultIBCVersion = NewVersion(DefaultIBCVersionIdentifier, []string{"ORDER_ORDERED", "ORDER_UNORDERED"})12 // DefaultIBCVersionIdentifier is the IBC v1.0.0 protocol version identifier13 DefaultIBCVersionIdentifier = "1"14 // AllowNilFeatureSet is a helper map to indicate if a specified version15 // identifier is allowed to have a nil feature set. Any versions supported,16 // but not included in the map default to not supporting nil feature sets.17 allowNilFeatureSet = map[string]bool{18 DefaultIBCVersionIdentifier: false,19 }20)21// NewVersion returns a new instance of Version.22func NewVersion(identifier string, features []string) Version {23 return Version{24 Identifier: identifier,25 Features: features,26 }27}28// GetIdentifier implements the VersionI interface29func (version Version) GetIdentifier() string {30 return version.Identifier31}32// GetFeatures implements the VersionI interface33func (version Version) GetFeatures() []string {34 return version.Features35}36// ValidateVersion does basic validation of the version identifier and37// features. It unmarshals the version string into a Version object.38func ValidateVersion(encodedVersion string) error {39 var version Version40 if err := SubModuleCdc.UnmarshalBinaryBare([]byte(encodedVersion), &version); err != nil {41 return sdkerrors.Wrapf(err, "failed to unmarshal version string %s", encodedVersion)42 }43 if strings.TrimSpace(version.Identifier) == "" {44 return sdkerrors.Wrap(ErrInvalidVersion, "version identifier cannot be blank")45 }46 for i, feature := range version.Features {47 if strings.TrimSpace(feature) == "" {48 return sdkerrors.Wrapf(ErrInvalidVersion, "feature cannot be blank, index %d", i)49 }50 }51 return nil52}53// Encode proto encodes the version and returns the bytes as a string.54func (version Version) Encode() (string, error) {55 encodedVersion, err := SubModuleCdc.MarshalBinaryBare(&version)56 if err != nil {57 return "", err58 }59 return string(encodedVersion), nil60}61// EncodeVersions iterates over the provided versions and marshals each62// into proto encoded strings. This represents the stored value of the version63// in the connection end as well as the value passed over the wire.64func EncodeVersions(versions []Version) ([]string, error) {65 encodedVersions := make([]string, len(versions))66 for i, version := range versions {67 ver, err := version.Encode()68 if err != nil {69 return nil, err70 }71 encodedVersions[i] = ver72 }73 return encodedVersions, nil74}75// DecodeVersion unmarshals a proto encoded version into a Version struct.76func DecodeVersion(encodedVersion string) (Version, error) {77 var version Version78 if err := SubModuleCdc.UnmarshalBinaryBare([]byte(encodedVersion), &version); err != nil {79 return Version{}, sdkerrors.Wrapf(err, "failed to unmarshal version string %s", encodedVersion)80 }81 return version, nil82}83// DecodeVersions returns the supplied list of proto encoded version strings84// as unmarshalled Version structs.85func DecodeVersions(encodedVersions []string) ([]Version, error) {86 versions := make([]Version, len(encodedVersions))87 for i, encodedVersion := range encodedVersions {88 version, err := DecodeVersion(encodedVersion)89 if err != nil {90 return nil, err91 }92 versions[i] = version93 }94 return versions, nil95}96// GetCompatibleVersions returns a descending ordered set of compatible IBC97// versions for the caller chain's connection end. The latest supported98// version should be first element and the set should descend to the oldest99// supported version.100func GetCompatibleVersions() []Version {101 return []Version{DefaultIBCVersion}102}103// GetCompatibleEncodedVersions returns the return value from GetCompatibleVersions104// as a proto encoded string.105func GetCompatibleEncodedVersions() []string {106 versions, err := EncodeVersions(GetCompatibleVersions())107 if err != nil {108 panic(err) // should not occur with properly set hardcoded versions109 }110 return versions111}112// FindSupportedVersion returns the version with a matching version identifier113// if it exists. The returned boolean is true if the version is found and114// false otherwise.115func FindSupportedVersion(version Version, supportedVersions []Version) (Version, bool) {116 for _, supportedVersion := range supportedVersions {117 if version.GetIdentifier() == supportedVersion.GetIdentifier() {118 return supportedVersion, true119 }120 }121 return Version{}, false122}123// PickVersion iterates over the descending ordered set of compatible IBC124// versions and selects the first version with a version identifier that is125// supported by the counterparty. The returned version contains a feature126// set with the intersection of the features supported by the source and127// counterparty chains. If the feature set intersection is nil and this is128// not allowed for the chosen version identifier then the search for a129// compatible version continues. This function is called in the ConnOpenTry130// handshake procedure.131func PickVersion(encodedCounterpartyVersions []string) (string, error) {132 counterpartyVersions, err := DecodeVersions(encodedCounterpartyVersions)133 if err != nil {134 return "", sdkerrors.Wrapf(err, "failed to unmarshal counterparty versions (%s) when attempting to pick compatible version", encodedCounterpartyVersions)135 }136 supportedVersions := GetCompatibleVersions()137 for _, supportedVersion := range supportedVersions {138 // check if the source version is supported by the counterparty139 if counterpartyVersion, found := FindSupportedVersion(supportedVersion, counterpartyVersions); found {140 featureSet := GetFeatureSetIntersection(supportedVersion.GetFeatures(), counterpartyVersion.GetFeatures())141 if len(featureSet) == 0 && !allowNilFeatureSet[supportedVersion.GetIdentifier()] {142 continue143 }144 return NewVersion(supportedVersion.GetIdentifier(), featureSet).Encode()145 }146 }147 return "", sdkerrors.Wrapf(148 ErrVersionNegotiationFailed,149 "failed to find a matching counterparty version (%s) from the supported version list (%s)", counterpartyVersions, supportedVersions,150 )151}152// GetFeatureSetIntersection returns the intersections of source feature set153// and the counterparty feature set. This is done by iterating over all the154// features in the source version and seeing if they exist in the feature155// set for the counterparty version.156func GetFeatureSetIntersection(sourceFeatureSet, counterpartyFeatureSet []string) (featureSet []string) {157 for _, feature := range sourceFeatureSet {158 if contains(feature, counterpartyFeatureSet) {159 featureSet = append(featureSet, feature)160 }161 }162 return featureSet163}164// VerifyProposedVersion verifies that the entire feature set in the165// proposed version is supported by this chain. If the feature set is166// empty it verifies that this is allowed for the specified version167// identifier.168func (version Version) VerifyProposedVersion(proposedVersion Version) error {169 if proposedVersion.GetIdentifier() != version.GetIdentifier() {170 return sdkerrors.Wrapf(171 ErrVersionNegotiationFailed,172 "proposed version identifier does not equal supported version identifier (%s != %s)", proposedVersion.GetIdentifier(), version.GetIdentifier(),173 )174 }175 if len(proposedVersion.GetFeatures()) == 0 && !allowNilFeatureSet[proposedVersion.GetIdentifier()] {176 return sdkerrors.Wrapf(177 ErrVersionNegotiationFailed,178 "nil feature sets are not supported for version identifier (%s)", proposedVersion.GetIdentifier(),179 )180 }181 for _, proposedFeature := range proposedVersion.GetFeatures() {182 if !contains(proposedFeature, version.GetFeatures()) {183 return sdkerrors.Wrapf(184 ErrVersionNegotiationFailed,185 "proposed feature (%s) is not a supported feature set (%s)", proposedFeature, version.GetFeatures(),186 )187 }188 }189 return nil190}191// VerifySupportedFeature takes in a version and feature string and returns192// true if the feature is supported by the version and false otherwise.193func VerifySupportedFeature(encodedVersion, feature string) bool {194 version, err := DecodeVersion(encodedVersion)195 if err != nil {196 return false197 }198 for _, f := range version.GetFeatures() {199 if f == feature {200 return true201 }202 }203 return false204}205// contains returns true if the provided string element exists within the206// string set.207func contains(elem string, set []string) bool {208 for _, element := range set {209 if elem == element {210 return true211 }212 }...
version_test.go
Source:version_test.go
...7)8func TestValidateVersion(t *testing.T) {9 testCases := []struct {10 name string11 version types.Version12 expPass bool13 }{14 {"valid version", types.DefaultIBCVersion, true},15 {"valid empty feature set", types.NewVersion(types.DefaultIBCVersionIdentifier, []string{}), true},16 {"empty version identifier", types.NewVersion(" ", []string{"ORDER_UNORDERED"}), false},17 {"empty feature", types.NewVersion(types.DefaultIBCVersionIdentifier, []string{"ORDER_UNORDERED", " "}), false},18 }19 for i, tc := range testCases {20 encodedVersion, err := tc.version.Encode()21 require.NoError(t, err, "test case %d failed to marshal version string: %s", i, tc.name)22 err = types.ValidateVersion(encodedVersion)23 if tc.expPass {24 require.NoError(t, err, "valid test case %d failed: %s", i, tc.name)25 } else {26 require.Error(t, err, "invalid test case %d passed: %s", i, tc.name)27 }28 }29}30func TestDecodeVersion(t *testing.T) {31 testCases := []struct {32 name string33 version string34 expVersion types.Version35 expPass bool36 }{37 {"valid version", ibctesting.ConnectionVersion, types.DefaultIBCVersion, true},38 {"invalid version", "not a proto encoded version", types.Version{}, false},39 {"empty string", " ", types.Version{}, false},40 }41 for i, tc := range testCases {42 version, err := types.DecodeVersion(tc.version)43 if tc.expPass {44 require.NoError(t, err, "valid test case %d failed: %s", i, tc.name)45 require.Equal(t, tc.expVersion, version)46 } else {47 require.Error(t, err, "invalid test case %d passed: %s", i, tc.name)48 }49 }50}51func TestFindSupportedVersion(t *testing.T) {52 testCases := []struct {53 name string54 version types.Version55 supportedVersions []types.Version56 expVersion types.Version57 expFound bool58 }{59 {"valid supported version", types.DefaultIBCVersion, types.GetCompatibleVersions(), types.DefaultIBCVersion, true},60 {"empty (invalid) version", types.Version{}, types.GetCompatibleVersions(), types.Version{}, false},61 {"empty supported versions", types.DefaultIBCVersion, []types.Version{}, types.Version{}, false},62 {"desired version is last", types.DefaultIBCVersion, []types.Version{types.NewVersion("1.1", nil), types.NewVersion("2", []string{"ORDER_UNORDERED"}), types.NewVersion("3", nil), types.DefaultIBCVersion}, types.DefaultIBCVersion, true},63 {"desired version identifier with different feature set", types.NewVersion(types.DefaultIBCVersionIdentifier, []string{"ORDER_DAG"}), types.GetCompatibleVersions(), types.DefaultIBCVersion, true},64 {"version not supported", types.NewVersion("2", []string{"ORDER_DAG"}), types.GetCompatibleVersions(), types.Version{}, false},65 }66 for i, tc := range testCases {67 version, found := types.FindSupportedVersion(tc.version, tc.supportedVersions)68 require.Equal(t, tc.expVersion.GetIdentifier(), version.GetIdentifier(), "test case %d: %s", i, tc.name)69 require.Equal(t, tc.expFound, found, "test case %d: %s", i, tc.name)70 }71}72func TestPickVersion(t *testing.T) {73 testCases := []struct {74 name string75 counterpartyVersions []types.Version76 expVer types.Version77 expPass bool78 }{79 {"valid default ibc version", types.GetCompatibleVersions(), types.DefaultIBCVersion, true},80 {"valid version in counterparty versions", []types.Version{types.NewVersion("version1", nil), types.NewVersion("2.0.0", []string{"ORDER_UNORDERED-ZK"}), types.DefaultIBCVersion}, types.DefaultIBCVersion, true},81 {"valid identifier match but empty feature set not allowed", []types.Version{types.NewVersion(types.DefaultIBCVersionIdentifier, []string{"DAG", "ORDERED-ZK", "UNORDERED-zk]"})}, types.NewVersion(types.DefaultIBCVersionIdentifier, nil), false},82 {"empty counterparty versions", []types.Version{}, types.Version{}, false},83 {"non-matching counterparty versions", []types.Version{types.NewVersion("2.0.0", nil)}, types.Version{}, false},84 }85 for i, tc := range testCases {86 encodedCounterpartyVersions, err := types.EncodeVersions(tc.counterpartyVersions)87 require.NoError(t, err)88 encodedVersion, err := types.PickVersion(encodedCounterpartyVersions)89 if tc.expPass {90 require.NoError(t, err, "valid test case %d failed: %s", i, tc.name)91 version, err := types.DecodeVersion(encodedVersion)92 require.NoError(t, err)93 require.Equal(t, tc.expVer, version, "valid test case %d falied: %s", i, tc.name)94 } else {95 require.Error(t, err, "invalid test case %d passed: %s", i, tc.name)96 require.Equal(t, "", encodedVersion, "invalid test case %d passed: %s", i, tc.name)97 }98 }99}100func TestVerifyProposedVersion(t *testing.T) {101 testCases := []struct {102 name string103 proposedVersion types.Version104 supportedVersion types.Version105 expPass bool106 }{107 {"entire feature set supported", types.DefaultIBCVersion, types.NewVersion("1", []string{"ORDER_ORDERED", "ORDER_UNORDERED", "ORDER_DAG"}), true},108 {"empty feature sets not supported", types.NewVersion("1", []string{}), types.DefaultIBCVersion, false},109 {"one feature missing", types.DefaultIBCVersion, types.NewVersion("1", []string{"ORDER_UNORDERED", "ORDER_DAG"}), false},110 {"both features missing", types.DefaultIBCVersion, types.NewVersion("1", []string{"ORDER_DAG"}), false},111 {"identifiers do not match", types.NewVersion("2", []string{"ORDER_UNORDERED", "ORDER_ORDERED"}), types.DefaultIBCVersion, false},112 }113 for i, tc := range testCases {114 err := tc.supportedVersion.VerifyProposedVersion(tc.proposedVersion)115 if tc.expPass {116 require.NoError(t, err, "test case %d: %s", i, tc.name)117 } else {118 require.Error(t, err, "test case %d: %s", i, tc.name)119 }120 }121}122func TestVerifySupportedFeature(t *testing.T) {123 nilFeatures, err := types.NewVersion(types.DefaultIBCVersionIdentifier, nil).Encode()124 require.NoError(t, err)125 testCases := []struct {126 name string127 version string128 feature string129 expPass bool130 }{131 {"check ORDERED supported", ibctesting.ConnectionVersion, "ORDER_ORDERED", true},132 {"check UNORDERED supported", ibctesting.ConnectionVersion, "ORDER_UNORDERED", true},133 {"check DAG unsupported", ibctesting.ConnectionVersion, "ORDER_DAG", false},134 {"check empty feature set returns false", nilFeatures, "ORDER_ORDERED", false},135 {"failed to unmarshal version", "not an encoded version", "ORDER_ORDERED", false},136 }137 for i, tc := range testCases {138 supported := types.VerifySupportedFeature(tc.version, tc.feature)139 require.Equal(t, tc.expPass, supported, "test case %d: %s", i, tc.name)140 }141}...
version
Using AI Code Generation
1use atoum\atoum\version;2use atoum\atoum\version;3use atoum\atoum\version;4use atoum\atoum\version;5use atoum\atoum\version;6use atoum\atoum\version;7use atoum\atoum\version;8use atoum\atoum\version;9use atoum\atoum\version;10use atoum\atoum\version;11use atoum\atoum\version;12use atoum\atoum\version;13use atoum\atoum\version;14use atoum\atoum\version;15use atoum\atoum\version;16use atoum\atoum\version;17use atoum\atoum\version;18use atoum\atoum\version;19use atoum\atoum\version;20use atoum\atoum\version;
version
Using AI Code Generation
1$version = new version();2$version->setVersion('1.0.0');3$version->setVersion('1.1.0');4$version->setVersion('1.1.1');5$version = new version();6$version->setVersion('1.0.0');7$version->setVersion('1.1.0');8$version->setVersion('1.0.0');9$version = new version();10$version->setVersion('1.0.0');11$version->setVersion('1.1.0');12$version->setVersion('1.0.0');13$version->setVersion('1.0.0');14$version = new version();15$version->setVersion('1.0.0');16$version->setVersion('1.1.0');17$version->setVersion('1.0.0');18$version->setVersion('1.0.0');19$version->setVersion('1.0.0');20$version = new version();21$version->setVersion('1.0.0');22$version->setVersion('1.1.0');23$version->setVersion('1.0.0');24$version->setVersion('1.0.0');25$version->setVersion('1.0.0');26$version->setVersion('1.0.0');27$version = new version();28$version->setVersion('1.0.0');
version
Using AI Code Generation
1use mageekguy\atoum\version;2$version = new version();3$version->getVersion();4$version->getBranch();5$version->getDate();6$version->getCommitHash();7$version->getCommitDate();8$version->getAuthorName();9$version->getAuthorEmail();10$version->getCommitMessage();11$version->getCommitSubject();12$version->getCommitBody();13$version->getCommitDescription();14$version->getCommitUrl();15$version->getCommitShortUrl();16$version->getCommitTreeUrl();17$version->getCommitShortTreeUrl();18$version->getCommitBlobUrl();19$version->getCommitShortBlobUrl();20$version->getCommitDiffUrl();21$version->getCommitShortDiffUrl();22$version->getCommitPatchUrl();23$version->getCommitShortPatchUrl();24$version->getCommitCommentUrl();25$version->getCommitShortCommentUrl();26$version->getCommitAuthorUrl();27$version->getCommitShortAuthorUrl();28$version->getCommitCommitterUrl();29$version->getCommitShortCommitterUrl();30$version->getCommitCommitterAvatarUrl();
version
Using AI Code Generation
1require_once 'Version.php';2$version = new Version(1, 0, 0);3require_once 'Version.php';4$version = new Version(1, 0, 0);5. 1/1 (100%) @0.000s6. 1/1 (100%) @0.000s
version
Using AI Code Generation
1include_once 'version.php';2$version = new Version();3echo $version->getVersion();4echo $version->getVersionNumber();5echo $version->getVersionDate();6echo $version->getVersionName();7echo $version->getVersionCode();8echo $version->getVersionMajor();9echo $version->getVersionMinor();10echo $version->getVersionPatch();11echo $version->getVersionBuild();
version
Using AI Code Generation
1$version = new \Version\Version();2$version = \Version\Version::getInstance();3$version->getVersion();4$version->getVersion('major');5$version->getVersion('minor');6$version->getVersion('patch');7$version->getVersion('build');8$version->getVersion('build', 'dev');9$version->getVersion('build', 'alpha');10$version->getVersion('build', 'beta');11$version->getVersion('build', 'rc');12$version->getVersion('build', 'stable');13$version->getVersion('build', 'release');14$version->getVersion('build', 'release', 'dev');15$version->getVersion('build', 'release', 'alpha');16$version->getVersion('build', 'release', 'beta');17$version->getVersion('build', 'release', 'rc');18$version->getVersion('build', 'release', 'stable');19$version->getVersion('build', 'release', 'release');20$version->getVersion('build', 'release', 'release', 'dev');21$version->getVersion('build', 'release', 'release', 'alpha');22$version->getVersion('build', 'release', 'release', 'beta');23$version->getVersion('build', 'release', 'release', 'rc');24$version->getVersion('build', 'release', 'release', 'stable');25$version->getVersion('build', 'release', 'release', 'release');26$version->getVersion('build', 'release', 'release', 'release', 'dev');27$version->getVersion('build', 'release', 'release', 'release', 'alpha');28$version->getVersion('build', 'release', 'release', 'release', 'beta');29$version->getVersion('build', 'release', 'release', 'release', 'rc');30$version->getVersion('build', 'release', 'release', 'release', 'stable');31$version->getVersion('build', 'release', 'release', 'release', 'release');32$version->getVersion('build', 'release', 'release', 'release', 'release', 'dev');33$version->getVersion('build', 'release', 'release', 'release', 'release', 'alpha');34$version->getVersion('build', 'release
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!!