@@ -78,4 +78,53 @@ public function testFailureMissingDevice()
7878 $ this ->expectException (BadRequestException::class);
7979 $ meta = new NMeta ('ios;production;1.0.0;10.2 ' );
8080 }
81+
82+ public function testFailureInvalidAppMajorVersion ()
83+ {
84+ $ this ->expectException (BadRequestException::class);
85+
86+ try {
87+ $ meta = new NMeta ('android;staging;1-staging.0.0;Android 12;SM-G975F ' );
88+ } catch (BadRequestException $ e ) {
89+ $ this ->assertEquals ('Meta header: Invalid Major version, expected integer ' , $ e ->getMessage ());
90+ throw $ e ;
91+ }
92+ }
93+
94+ public function testFailureInvalidAppMinorVersion ()
95+ {
96+ $ this ->expectException (BadRequestException::class);
97+
98+ try {
99+ $ meta = new NMeta ('android;staging;1.0-staging.0;Android 12;SM-G975F ' );
100+ } catch (BadRequestException $ e ) {
101+ $ this ->assertEquals ('Meta header: Invalid Minor version, expected integer ' , $ e ->getMessage ());
102+ throw $ e ;
103+ }
104+ }
105+
106+ public function testFailureInvalidAppPatchVersion ()
107+ {
108+ $ this ->expectException (BadRequestException::class);
109+
110+ try {
111+ $ meta = new NMeta ('android;staging;1.0.0-staging;Android 12;SM-G975F ' );
112+ } catch (BadRequestException $ e ) {
113+ $ this ->assertEquals ('Meta header: Invalid Patch version, expected integer ' , $ e ->getMessage ());
114+ throw $ e ;
115+ }
116+ }
117+
118+ public function testFailureInvalidAmountOfVersionSegments ()
119+ {
120+ $ this ->expectException (BadRequestException::class);
121+
122+ try {
123+ $ meta = new NMeta ('android;staging;1.0;Android 12;SM-G975F ' );
124+ } catch (BadRequestException $ e ) {
125+ $ expected = 'Meta header: Invalid app version, invalid amount of segments. Expected semver [x.y.z] ' ;
126+ $ this ->assertEquals ($ expected , $ e ->getMessage ());
127+ throw $ e ;
128+ }
129+ }
81130}
0 commit comments