1<?php 2 3require_once('test_util.php'); 4 5use Google\Protobuf\Internal\RepeatedField; 6use Google\Protobuf\Internal\GPBType; 7use Foo\TestMessage; 8use Foo\TestMessage\Sub; 9 10class UndefinedTest extends PHPUnit_Framework_TestCase 11{ 12 13 /** 14 * @expectedException PHPUnit_Framework_Error 15 */ 16 public function testInt32AppendStringFail() 17 { 18 $arr = new RepeatedField(GPBType::INT32); 19 $arr[] = 'abc'; 20 } 21 22 /** 23 * @expectedException PHPUnit_Framework_Error 24 */ 25 public function testInt32SetStringFail() 26 { 27 $arr = new RepeatedField(GPBType::INT32); 28 $arr[] = 0; 29 $arr[0] = 'abc'; 30 } 31 32 /** 33 * @expectedException PHPUnit_Framework_Error 34 */ 35 public function testInt32AppendMessageFail() 36 { 37 $arr = new RepeatedField(GPBType::INT32); 38 $arr[] = new Sub(); 39 } 40 41 /** 42 * @expectedException PHPUnit_Framework_Error 43 */ 44 public function testInt32SetMessageFail() 45 { 46 $arr = new RepeatedField(GPBType::INT32); 47 $arr[] = 0; 48 $arr[0] = new Sub(); 49 } 50 51 /** 52 * @expectedException PHPUnit_Framework_Error 53 */ 54 public function testUint32AppendStringFail() 55 { 56 $arr = new RepeatedField(GPBType::UINT32); 57 $arr[] = 'abc'; 58 } 59 60 /** 61 * @expectedException PHPUnit_Framework_Error 62 */ 63 public function testUint32SetStringFail() 64 { 65 $arr = new RepeatedField(GPBType::UINT32); 66 $arr[] = 0; 67 $arr[0] = 'abc'; 68 } 69 70 /** 71 * @expectedException PHPUnit_Framework_Error 72 */ 73 public function testUint32AppendMessageFail() 74 { 75 $arr = new RepeatedField(GPBType::UINT32); 76 $arr[] = new Sub(); 77 } 78 79 /** 80 * @expectedException PHPUnit_Framework_Error 81 */ 82 public function testUint32SetMessageFail() 83 { 84 $arr = new RepeatedField(GPBType::UINT32); 85 $arr[] = 0; 86 $arr[0] = new Sub(); 87 } 88 89 /** 90 * @expectedException PHPUnit_Framework_Error 91 */ 92 public function testInt64AppendStringFail() 93 { 94 $arr = new RepeatedField(GPBType::INT64); 95 $arr[] = 'abc'; 96 } 97 98 /** 99 * @expectedException PHPUnit_Framework_Error 100 */ 101 public function testInt64SetStringFail() 102 { 103 $arr = new RepeatedField(GPBType::INT64); 104 $arr[] = 0; 105 $arr[0] = 'abc'; 106 } 107 108 /** 109 * @expectedException PHPUnit_Framework_Error 110 */ 111 public function testInt64AppendMessageFail() 112 { 113 $arr = new RepeatedField(GPBType::INT64); 114 $arr[] = new Sub(); 115 } 116 117 /** 118 * @expectedException PHPUnit_Framework_Error 119 */ 120 public function testInt64SetMessageFail() 121 { 122 $arr = new RepeatedField(GPBType::INT64); 123 $arr[] = 0; 124 $arr[0] = new Sub(); 125 } 126 127 /** 128 * @expectedException PHPUnit_Framework_Error 129 */ 130 public function testUint64AppendStringFail() 131 { 132 $arr = new RepeatedField(GPBType::UINT64); 133 $arr[] = 'abc'; 134 } 135 136 /** 137 * @expectedException PHPUnit_Framework_Error 138 */ 139 public function testUint64SetStringFail() 140 { 141 $arr = new RepeatedField(GPBType::UINT64); 142 $arr[] = 0; 143 $arr[0] = 'abc'; 144 } 145 146 /** 147 * @expectedException PHPUnit_Framework_Error 148 */ 149 public function testUint64AppendMessageFail() 150 { 151 $arr = new RepeatedField(GPBType::UINT64); 152 $arr[] = new Sub(); 153 } 154 155 /** 156 * @expectedException PHPUnit_Framework_Error 157 */ 158 public function testUint64SetMessageFail() 159 { 160 $arr = new RepeatedField(GPBType::UINT64); 161 $arr[] = 0; 162 $arr[0] = new Sub(); 163 } 164 165 /** 166 * @expectedException PHPUnit_Framework_Error 167 */ 168 public function testFloatAppendStringFail() 169 { 170 $arr = new RepeatedField(GPBType::FLOAT); 171 $arr[] = 'abc'; 172 } 173 174 /** 175 * @expectedException PHPUnit_Framework_Error 176 */ 177 public function testFloatSetStringFail() 178 { 179 $arr = new RepeatedField(GPBType::FLOAT); 180 $arr[] = 0.0; 181 $arr[0] = 'abc'; 182 } 183 184 /** 185 * @expectedException PHPUnit_Framework_Error 186 */ 187 public function testFloatAppendMessageFail() 188 { 189 $arr = new RepeatedField(GPBType::FLOAT); 190 $arr[] = new Sub(); 191 } 192 193 /** 194 * @expectedException PHPUnit_Framework_Error 195 */ 196 public function testFloatSetMessageFail() 197 { 198 $arr = new RepeatedField(GPBType::FLOAT); 199 $arr[] = 0.0; 200 $arr[0] = new Sub(); 201 } 202 203 /** 204 * @expectedException PHPUnit_Framework_Error 205 */ 206 public function testDoubleAppendStringFail() 207 { 208 $arr = new RepeatedField(GPBType::DOUBLE); 209 $arr[] = 'abc'; 210 } 211 212 /** 213 * @expectedException PHPUnit_Framework_Error 214 */ 215 public function testDoubleSetStringFail() 216 { 217 $arr = new RepeatedField(GPBType::DOUBLE); 218 $arr[] = 0.0; 219 $arr[0] = 'abc'; 220 } 221 222 /** 223 * @expectedException PHPUnit_Framework_Error 224 */ 225 public function testDoubleAppendMessageFail() 226 { 227 $arr = new RepeatedField(GPBType::DOUBLE); 228 $arr[] = new Sub(); 229 } 230 231 /** 232 * @expectedException PHPUnit_Framework_Error 233 */ 234 public function testDoubleSetMessageFail() 235 { 236 $arr = new RepeatedField(GPBType::DOUBLE); 237 $arr[] = 0.0; 238 $arr[0] = new Sub(); 239 } 240 241 /** 242 * @expectedException PHPUnit_Framework_Error 243 */ 244 public function testBoolAppendMessageFail() 245 { 246 $arr = new RepeatedField(GPBType::BOOL); 247 $arr[] = new Sub(); 248 } 249 250 /** 251 * @expectedException PHPUnit_Framework_Error 252 */ 253 public function testBoolSetMessageFail() 254 { 255 $arr = new RepeatedField(GPBType::BOOL); 256 $arr[] = true; 257 $arr[0] = new Sub(); 258 } 259 260 /** 261 * @expectedException PHPUnit_Framework_Error 262 */ 263 public function testStringAppendMessageFail() 264 { 265 $arr = new RepeatedField(GPBType::STRING); 266 $arr[] = new Sub(); 267 } 268 269 /** 270 * @expectedException PHPUnit_Framework_Error 271 */ 272 public function testStringSetMessageFail() 273 { 274 $arr = new RepeatedField(GPBType::STRING); 275 $arr[] = 'abc'; 276 $arr[0] = new Sub(); 277 } 278 279 /** 280 * @expectedException PHPUnit_Framework_Error 281 */ 282 public function testStringAppendInvalidUTF8Fail() 283 { 284 $arr = new RepeatedField(GPBType::STRING); 285 $hex = hex2bin("ff"); 286 $arr[] = $hex; 287 } 288 289 /** 290 * @expectedException PHPUnit_Framework_Error 291 */ 292 public function testStringSetInvalidUTF8Fail() 293 { 294 $arr = new RepeatedField(GPBType::STRING); 295 $arr[] = 'abc'; 296 $hex = hex2bin("ff"); 297 $arr[0] = $hex; 298 } 299 300 /** 301 * @expectedException PHPUnit_Framework_Error 302 */ 303 public function testMessageAppendIntFail() 304 { 305 $arr = new RepeatedField(GPBType::MESSAGE, Sub::class); 306 $arr[] = 1; 307 } 308 309 /** 310 * @expectedException PHPUnit_Framework_Error 311 */ 312 public function testMessageSetIntFail() 313 { 314 $arr = new RepeatedField(GPBType::MESSAGE, Sub::class); 315 $arr[] = new Sub; 316 $arr[0] = 'abc'; 317 } 318 319 /** 320 * @expectedException PHPUnit_Framework_Error 321 */ 322 public function testMessageAppendStringFail() 323 { 324 $arr = new RepeatedField(GPBType::MESSAGE, Sub::class); 325 $arr[] = 'abc'; 326 } 327 328 /** 329 * @expectedException PHPUnit_Framework_Error 330 */ 331 public function testMessageSetStringFail() 332 { 333 $arr = new RepeatedField(GPBType::MESSAGE, Sub::class); 334 $arr[] = new Sub; 335 $arr[0] = 'abc'; 336 } 337 338 /** 339 * @expectedException PHPUnit_Framework_Error 340 */ 341 public function testMessageAppendOtherMessageFail() 342 { 343 $arr = new RepeatedField(GPBType::MESSAGE, Sub::class); 344 $arr[] = new TestMessage; 345 } 346 347 /** 348 * @expectedException PHPUnit_Framework_Error 349 */ 350 public function testMessageAppendNullFail() 351 { 352 $arr = new RepeatedField(GPBType::MESSAGE, Sub::class); 353 $null = null; 354 $arr[] = $null; 355 } 356 357 /** 358 * @expectedException PHPUnit_Framework_Error 359 */ 360 public function testMessageSetNullFail() 361 { 362 $arr = new RepeatedField(GPBType::MESSAGE, Sub::class); 363 $arr[] = new Sub(); 364 $null = null; 365 $arr[0] = $null; 366 } 367 368 /** 369 * @expectedException PHPUnit_Framework_Error 370 */ 371 public function testRemoveMiddleFail() 372 { 373 $arr = new RepeatedField(GPBType::INT32); 374 375 $arr[] = 0; 376 $arr[] = 1; 377 $arr[] = 2; 378 $this->assertSame(3, count($arr)); 379 380 unset($arr[1]); 381 } 382 383 /** 384 * @expectedException PHPUnit_Framework_Error 385 */ 386 public function testRemoveEmptyFail() 387 { 388 $arr = new RepeatedField(GPBType::INT32); 389 390 unset($arr[0]); 391 } 392 393 /** 394 * @expectedException PHPUnit_Framework_Error 395 */ 396 public function testMessageOffsetFail() 397 { 398 $arr = new RepeatedField(GPBType::INT32); 399 $arr[] = 0; 400 $arr[new Sub()] = 0; 401 } 402 403 /** 404 * @expectedException PHPUnit_Framework_Error 405 */ 406 public function testStringOffsetFail() 407 { 408 $arr = new RepeatedField(GPBType::INT32); 409 $arr[] = 0; 410 $arr['abc'] = 0; 411 } 412 413 /** 414 * @expectedException PHPUnit_Framework_Error 415 */ 416 public function testSetNonExistedOffsetFail() 417 { 418 $arr = new RepeatedField(GPBType::INT32); 419 $arr[0] = 0; 420 } 421 422 /** 423 * @expectedException PHPUnit_Framework_Error 424 */ 425 public function testInt32FieldInvalidTypeFail() 426 { 427 $m = new TestMessage(); 428 $m->setOptionalInt32(new TestMessage()); 429 } 430 431 /** 432 * @expectedException PHPUnit_Framework_Error 433 */ 434 public function testInt32FieldInvalidStringFail() 435 { 436 $m = new TestMessage(); 437 $m->setOptionalInt32('abc'); 438 } 439 440 /** 441 * @expectedException PHPUnit_Framework_Error 442 */ 443 public function testUint32FieldInvalidTypeFail() 444 { 445 $m = new TestMessage(); 446 $m->setOptionalUint32(new TestMessage()); 447 } 448 449 /** 450 * @expectedException PHPUnit_Framework_Error 451 */ 452 public function testUint32FieldInvalidStringFail() 453 { 454 $m = new TestMessage(); 455 $m->setOptionalUint32('abc'); 456 } 457 458 /** 459 * @expectedException PHPUnit_Framework_Error 460 */ 461 public function testInt64FieldInvalidTypeFail() 462 { 463 $m = new TestMessage(); 464 $m->setOptionalInt64(new TestMessage()); 465 } 466 467 /** 468 * @expectedException PHPUnit_Framework_Error 469 */ 470 public function testInt64FieldInvalidStringFail() 471 { 472 $m = new TestMessage(); 473 $m->setOptionalInt64('abc'); 474 } 475 476 /** 477 * @expectedException PHPUnit_Framework_Error 478 */ 479 public function testUint64FieldInvalidTypeFail() 480 { 481 $m = new TestMessage(); 482 $m->setOptionalUint64(new TestMessage()); 483 } 484 485 /** 486 * @expectedException PHPUnit_Framework_Error 487 */ 488 public function testUint64FieldInvalidStringFail() 489 { 490 $m = new TestMessage(); 491 $m->setOptionalUint64('abc'); 492 } 493 494 /** 495 * @expectedException PHPUnit_Framework_Error 496 */ 497 public function testFloatFieldInvalidTypeFail() 498 { 499 $m = new TestMessage(); 500 $m->setOptionalFloat(new TestMessage()); 501 } 502 503 /** 504 * @expectedException PHPUnit_Framework_Error 505 */ 506 public function testFloatFieldInvalidStringFail() 507 { 508 $m = new TestMessage(); 509 $m->setOptionalFloat('abc'); 510 } 511 512 /** 513 * @expectedException PHPUnit_Framework_Error 514 */ 515 public function testDoubleFieldInvalidTypeFail() 516 { 517 $m = new TestMessage(); 518 $m->setOptionalDouble(new TestMessage()); 519 } 520 521 /** 522 * @expectedException PHPUnit_Framework_Error 523 */ 524 public function testDoubleFieldInvalidStringFail() 525 { 526 $m = new TestMessage(); 527 $m->setOptionalDouble('abc'); 528 } 529 530 /** 531 * @expectedException PHPUnit_Framework_Error 532 */ 533 public function testBoolFieldInvalidStringFail() 534 { 535 $m = new TestMessage(); 536 $m->setOptionalBool(new TestMessage()); 537 } 538 539 /** 540 * @expectedException PHPUnit_Framework_Error 541 */ 542 public function testStringFieldInvalidUTF8Fail() 543 { 544 $m = new TestMessage(); 545 $hex = hex2bin("ff"); 546 $m->setOptionalString($hex); 547 } 548 549 /** 550 * @expectedException PHPUnit_Framework_Error 551 */ 552 public function testMessageFieldWrongTypeFail() 553 { 554 $m = new TestMessage(); 555 $a = 1; 556 $m->setOptionalMessage($a); 557 } 558 559 /** 560 * @expectedException PHPUnit_Framework_Error 561 */ 562 public function testMessageFieldWrongClassFail() 563 { 564 $m = new TestMessage(); 565 $m->setOptionalMessage(new TestMessage()); 566 } 567 568 /** 569 * @expectedException PHPUnit_Framework_Error 570 */ 571 public function testRepeatedFieldWrongTypeFail() 572 { 573 $m = new TestMessage(); 574 $a = 1; 575 $m->setRepeatedInt32($a); 576 } 577 578 /** 579 * @expectedException PHPUnit_Framework_Error 580 */ 581 public function testRepeatedFieldWrongObjectFail() 582 { 583 $m = new TestMessage(); 584 $m->setRepeatedInt32($m); 585 } 586 587 /** 588 * @expectedException PHPUnit_Framework_Error 589 */ 590 public function testRepeatedFieldWrongRepeatedTypeFail() 591 { 592 $m = new TestMessage(); 593 594 $repeated_int32 = new RepeatedField(GPBType::UINT32); 595 $m->setRepeatedInt32($repeated_int32); 596 } 597 598 /** 599 * @expectedException PHPUnit_Framework_Error 600 */ 601 public function testRepeatedFieldWrongRepeatedMessageClassFail() 602 { 603 $m = new TestMessage(); 604 605 $repeated_message = new RepeatedField(GPBType::MESSAGE, 606 TestMessage::class); 607 $m->setRepeatedMessage($repeated_message); 608 } 609 610 /** 611 * @expectedException PHPUnit_Framework_Error 612 */ 613 public function testMapFieldWrongTypeFail() 614 { 615 $m = new TestMessage(); 616 $a = 1; 617 $m->setMapInt32Int32($a); 618 } 619 620 /** 621 * @expectedException PHPUnit_Framework_Error 622 */ 623 public function testMapFieldWrongObjectFail() 624 { 625 $m = new TestMessage(); 626 $m->setMapInt32Int32($m); 627 } 628 629 /** 630 * @expectedException PHPUnit_Framework_Error 631 */ 632 public function testMapFieldWrongRepeatedTypeFail() 633 { 634 $m = new TestMessage(); 635 636 $map_uint32_uint32 = new MapField(GPBType::UINT32, GPBType::UINT32); 637 $m->setMapInt32Int32($map_uint32_uint32); 638 } 639 640 /** 641 * @expectedException PHPUnit_Framework_Error 642 */ 643 public function testMapFieldWrongRepeatedMessageClassFail() 644 { 645 $m = new TestMessage(); 646 647 $map_int32_message = new MapField(GPBType::INT32, 648 GPBType::MESSAGE, 649 TestMessage::class); 650 $m->setMapInt32Message($map_int32_message); 651 } 652 653 /** 654 * @expectedException PHPUnit_Framework_Error 655 */ 656 public function testMessageMergeFromInvalidTypeFail() 657 { 658 $m = new TestMessage(); 659 $n = new Sub(); 660 $m->mergeFrom($n); 661 } 662 663 /** 664 * @expectedException PHPUnit_Framework_Error 665 */ 666 public function testInt32SetStringKeyFail() 667 { 668 $arr = new MapField(GPBType::INT32, GPBType::INT32); 669 $arr['abc'] = 0; 670 } 671 672 /** 673 * @expectedException PHPUnit_Framework_Error 674 */ 675 public function testInt32SetStringValueFail() 676 { 677 $arr = new MapField(GPBType::INT32, GPBType::INT32); 678 $arr[0] = 'abc'; 679 } 680 681 /** 682 * @expectedException PHPUnit_Framework_Error 683 */ 684 public function testInt32SetMessageKeyFail() 685 { 686 $arr = new MapField(GPBType::INT32, GPBType::INT32); 687 $arr[new Sub()] = 0; 688 } 689 690 /** 691 * @expectedException PHPUnit_Framework_Error 692 */ 693 public function testInt32SetMessageValueFail() 694 { 695 $arr = new MapField(GPBType::INT32, GPBType::INT32); 696 $arr[0] = new Sub(); 697 } 698 699 /** 700 * @expectedException PHPUnit_Framework_Error 701 */ 702 public function testUint32SetStringKeyFail() 703 { 704 $arr = new MapField(GPBType::UINT32, GPBType::UINT32); 705 $arr['abc'] = 0; 706 } 707 708 /** 709 * @expectedException PHPUnit_Framework_Error 710 */ 711 public function testUint32SetStringValueFail() 712 { 713 $arr = new MapField(GPBType::UINT32, GPBType::UINT32); 714 $arr[0] = 'abc'; 715 } 716 717 /** 718 * @expectedException PHPUnit_Framework_Error 719 */ 720 public function testUint32SetMessageKeyFail() 721 { 722 $arr = new MapField(GPBType::UINT32, GPBType::UINT32); 723 $arr[new Sub()] = 0; 724 } 725 726 /** 727 * @expectedException PHPUnit_Framework_Error 728 */ 729 public function testUint32SetMessageValueFail() 730 { 731 $arr = new MapField(GPBType::UINT32, GPBType::UINT32); 732 $arr[0] = new Sub(); 733 } 734 735 /** 736 * @expectedException PHPUnit_Framework_Error 737 */ 738 public function testInt64SetStringKeyFail() 739 { 740 $arr = new MapField(GPBType::INT64, GPBType::INT64); 741 $arr['abc'] = 0; 742 } 743 744 /** 745 * @expectedException PHPUnit_Framework_Error 746 */ 747 public function testInt64SetStringValueFail() 748 { 749 $arr = new MapField(GPBType::INT64, GPBType::INT64); 750 $arr[0] = 'abc'; 751 } 752 753 /** 754 * @expectedException PHPUnit_Framework_Error 755 */ 756 public function testInt64SetMessageKeyFail() 757 { 758 $arr = new MapField(GPBType::INT64, GPBType::INT64); 759 $arr[new Sub()] = 0; 760 } 761 762 /** 763 * @expectedException PHPUnit_Framework_Error 764 */ 765 public function testInt64SetMessageValueFail() 766 { 767 $arr = new MapField(GPBType::INT64, GPBType::INT64); 768 $arr[0] = new Sub(); 769 } 770 771 /** 772 * @expectedException PHPUnit_Framework_Error 773 */ 774 public function testUint64SetStringKeyFail() 775 { 776 $arr = new MapField(GPBType::UINT64, GPBType::UINT64); 777 $arr['abc'] = 0; 778 } 779 780 /** 781 * @expectedException PHPUnit_Framework_Error 782 */ 783 public function testUint64SetStringValueFail() 784 { 785 $arr = new MapField(GPBType::UINT64, GPBType::UINT64); 786 $arr[0] = 'abc'; 787 } 788 789 /** 790 * @expectedException PHPUnit_Framework_Error 791 */ 792 public function testUint64SetMessageKeyFail() 793 { 794 $arr = new MapField(GPBType::UINT64, GPBType::UINT64); 795 $arr[new Sub()] = 0; 796 } 797 798 /** 799 * @expectedException PHPUnit_Framework_Error 800 */ 801 public function testUint64SetMessageValueFail() 802 { 803 $arr = new MapField(GPBType::UINT64, GPBType::UINT64); 804 $arr[0] = new Sub(); 805 } 806 807 /** 808 * @expectedException PHPUnit_Framework_Error 809 */ 810 public function testDoubleSetStringValueFail() 811 { 812 $arr = new MapField(GPBType::INT64, GPBType::DOUBLE); 813 $arr[0] = 'abc'; 814 } 815 816 /** 817 * @expectedException PHPUnit_Framework_Error 818 */ 819 public function testDoubleSetMessageValueFail() 820 { 821 $arr = new MapField(GPBType::INT64, GPBType::DOUBLE); 822 $arr[0] = new Sub(); 823 } 824 825 /** 826 * @expectedException PHPUnit_Framework_Error 827 */ 828 public function testBoolSetMessageKeyFail() 829 { 830 $arr = new MapField(GPBType::BOOL, GPBType::BOOL); 831 $arr[new Sub()] = true; 832 } 833 834 /** 835 * @expectedException PHPUnit_Framework_Error 836 */ 837 public function testBoolSetMessageValueFail() 838 { 839 $arr = new MapField(GPBType::BOOL, GPBType::BOOL); 840 $arr[true] = new Sub(); 841 } 842 843 /** 844 * @expectedException PHPUnit_Framework_Error 845 */ 846 public function testStringSetInvalidUTF8KeyFail() 847 { 848 $arr = new MapField(GPBType::STRING, GPBType::STRING); 849 $arr[hex2bin("ff")] = 'abc'; 850 } 851 852 /** 853 * @expectedException PHPUnit_Framework_Error 854 */ 855 public function testStringSetInvalidUTF8ValueFail() 856 { 857 $arr = new MapField(GPBType::STRING, GPBType::STRING); 858 $arr['abc'] = hex2bin("ff"); 859 } 860 861 /** 862 * @expectedException PHPUnit_Framework_Error 863 */ 864 public function testStringSetMessageKeyFail() 865 { 866 $arr = new MapField(GPBType::STRING, GPBType::STRING); 867 $arr[new Sub()] = 'abc'; 868 } 869 870 /** 871 * @expectedException PHPUnit_Framework_Error 872 */ 873 public function testStringSetMessageValueFail() 874 { 875 $arr = new MapField(GPBType::STRING, GPBType::STRING); 876 $arr['abc'] = new Sub(); 877 } 878 879 /** 880 * @expectedException PHPUnit_Framework_Error 881 */ 882 public function testMessageSetIntValueFail() 883 { 884 $arr = 885 new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class); 886 $arr[0] = 0; 887 } 888 889 /** 890 * @expectedException PHPUnit_Framework_Error 891 */ 892 public function testMessageSetStringValueFail() 893 { 894 $arr = 895 new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class); 896 $arr[0] = 'abc'; 897 } 898 899 /** 900 * @expectedException PHPUnit_Framework_Error 901 */ 902 public function testMessageSetOtherMessageValueFail() 903 { 904 $arr = 905 new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class); 906 $arr[0] = new Sub(); 907 } 908 909 /** 910 * @expectedException PHPUnit_Framework_Error 911 */ 912 public function testMessageSetNullFailMap() 913 { 914 $arr = 915 new MapField(GPBType::INT32, GPBType::MESSAGE, TestMessage::class); 916 $null = NULL; 917 $arr[0] = $null; 918 } 919 920} 921