11<?php
22namespace GraphQL \Tests \Type ;
33
4- use GraphQL \Error \InvariantViolation ;
4+ use GraphQL \Error \UserError ;
55use GraphQL \Type \Definition \Type ;
66
77class ScalarSerializationTest extends \PHPUnit_Framework_TestCase
@@ -28,28 +28,28 @@ public function testSerializesOutputInt()
2828 try {
2929 $ intType ->serialize (9876504321 );
3030 $ this ->fail ('Expected exception was not thrown ' );
31- } catch (InvariantViolation $ e ) {
31+ } catch (UserError $ e ) {
3232 $ this ->assertEquals ('Int cannot represent non 32-bit signed integer value: 9876504321 ' , $ e ->getMessage ());
3333 }
3434
3535 try {
3636 $ intType ->serialize (-9876504321 );
3737 $ this ->fail ('Expected exception was not thrown ' );
38- } catch (InvariantViolation $ e ) {
38+ } catch (UserError $ e ) {
3939 $ this ->assertEquals ('Int cannot represent non 32-bit signed integer value: -9876504321 ' , $ e ->getMessage ());
4040 }
4141
4242 try {
4343 $ intType ->serialize (1e100 );
4444 $ this ->fail ('Expected exception was not thrown ' );
45- } catch (InvariantViolation $ e ) {
45+ } catch (UserError $ e ) {
4646 $ this ->assertEquals ('Int cannot represent non 32-bit signed integer value: 1.0E+100 ' , $ e ->getMessage ());
4747 }
4848
4949 try {
5050 $ intType ->serialize (-1e100 );
5151 $ this ->fail ('Expected exception was not thrown ' );
52- } catch (InvariantViolation $ e ) {
52+ } catch (UserError $ e ) {
5353 $ this ->assertEquals ('Int cannot represent non 32-bit signed integer value: -1.0E+100 ' , $ e ->getMessage ());
5454 }
5555
@@ -58,14 +58,14 @@ public function testSerializesOutputInt()
5858 try {
5959 $ intType ->serialize ('one ' );
6060 $ this ->fail ('Expected exception was not thrown ' );
61- } catch (InvariantViolation $ e ) {
61+ } catch (UserError $ e ) {
6262 $ this ->assertEquals ('Int cannot represent non 32-bit signed integer value: one ' , $ e ->getMessage ());
6363 }
6464
6565 try {
6666 $ intType ->serialize ('' );
6767 $ this ->fail ('Expected exception was not thrown ' );
68- } catch (InvariantViolation $ e ) {
68+ } catch (UserError $ e ) {
6969 $ this ->assertEquals ('Int cannot represent non 32-bit signed integer value: (empty string) ' , $ e ->getMessage ());
7070 }
7171
@@ -92,14 +92,14 @@ public function testSerializesOutputFloat()
9292 try {
9393 $ floatType ->serialize ('one ' );
9494 $ this ->fail ('Expected exception was not thrown ' );
95- } catch (InvariantViolation $ e ) {
95+ } catch (UserError $ e ) {
9696 $ this ->assertEquals ('Float cannot represent non numeric value: one ' , $ e ->getMessage ());
9797 }
9898
9999 try {
100100 $ floatType ->serialize ('' );
101101 $ this ->fail ('Expected exception was not thrown ' );
102- } catch (InvariantViolation $ e ) {
102+ } catch (UserError $ e ) {
103103 $ this ->assertEquals ('Float cannot represent non numeric value: (empty string) ' , $ e ->getMessage ());
104104 }
105105
0 commit comments