Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Verify that SemVer patch version generation works. #36

Merged
merged 1 commit into from
Feb 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Adding tests to validate that Generation supports SemVer patches.
Resolves #34
  • Loading branch information
Jon Ursenbach committed Feb 25, 2017
commit 7f9c73220e7ed448977e39065fba7bad21fedf5e
4 changes: 3 additions & 1 deletion resources/examples/Showtimes/Controllers/Movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public function GET()
* @api-param:public {string} runtime (optional) Movie runtime, in `HHhr MMmin` format.
* @api-param:public {string} content_rating [G|PG|PG-13|R|NC-17|X|NR|UR] (optional) MPAA rating
* @api-param:public {array} genres (optional) Array of movie genres.
* @api-param:public {string} imdb (optional) IMDB URL
* @api-param:public {string} trailer (optional) Trailer URL
* @api-param:public {string} director (optional) Name of the director.
* @api-param:public {array} cast (optional) Array of names of the cast.
Expand All @@ -56,6 +55,9 @@ public function GET()
* request.
* @api-throws:public {400} \Mill\Examples\Showtimes\Representations\Error If the IMDB URL could not be validated.
* @api-throws:public {404} \Mill\Examples\Showtimes\Representations\Error If the movie could not be found.
*
* @api-version >=1.1.1
* @api-param:public {string} imdb (optional) IMDB URL
*/
public function PATCH()
{
Expand Down
2 changes: 1 addition & 1 deletion resources/examples/Showtimes/Controllers/Movies.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function GET()
* request.
* @api-throws:public {400} \Mill\Examples\Showtimes\Representations\Error If the IMDB URL could not be validated.
*
* @api-version 1.1
* @api-version >=1.1
* @api-param:public {string} imdb (optional) IMDB URL
* @api-param:public {string} trailer (optional) Trailer URL
*/
Expand Down
2 changes: 1 addition & 1 deletion resources/examples/Showtimes/Representations/Movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function create()
* @api-label Urls
* @api-field urls
* @api-type object
* @api-version 1.1
* @api-version >=1.1
* @api-see \Mill\Examples\Showtimes\Representations\Movie::getUrls urls
*/
'urls' => $this->getUrls(),
Expand Down
191 changes: 191 additions & 0 deletions resources/examples/Showtimes/blueprints/1.1.1/Movies.apib
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
FORMAT: 1A

# Movies
## Movies [/movies/{id}]
Information on a specific movie.

### Get a single movie. [GET]
+ Parameters
+ `id` (integer, required) - Movie ID
+ Response 200 (application/json)
+ Attributes
- `cast` (array) - Cast
- `content_rating` (enum[string]) - MPAA rating
+ Members
+ `G`
+ `PG`
+ `PG-13`
+ `R`
+ `NC-17`
+ `X`
+ `NR`
+ `UR`
- `description` (string) - Description
- `director` (string) - Director
- `genres` (array) - Genres
- `id` (number) - Unique ID
- `name` (string) - Name
- `runtime` (string) - Runtime
- `showtimes` (array) - Non-theater specific showtimes
- `theaters` (array) - Theaters the movie is currently showing in
- `uri` (string) - Movie URI
- `urls` (object) - Urls
- `imdb` (string) - IMDB URL
- `tickets` (string) - Tickets URL
- `trailer` (string) - Trailer URL
+ Response 304 (application/json)
+ Response 404 (application/json)

### Update a movie. [PATCH]
This action requires a bearer token with `edit` scope.

+ Parameters
+ `id` (integer, required) - Movie ID
+ Request
+ Attributes
- `name` (string, required) - Name of the movie.
- `description` (string, required) - Description, or tagline, for the movie.
- `runtime` (string) - Movie runtime, in `HHhr MMmin` format.
- `content_rating` (enum[string]) - MPAA rating
+ Members
+ `G`
+ `PG`
+ `PG-13`
+ `R`
+ `NC-17`
+ `X`
+ `NR`
+ `UR`
- `genres` (string) - Array of movie genres.
- `trailer` (string) - Trailer URL
- `director` (string) - Name of the director.
- `cast` (string) - Array of names of the cast.
- `imdb` (string) - IMDB URL
+ Response 200 (application/json)
+ Attributes
- `cast` (array) - Cast
- `content_rating` (enum[string]) - MPAA rating
+ Members
+ `G`
+ `PG`
+ `PG-13`
+ `R`
+ `NC-17`
+ `X`
+ `NR`
+ `UR`
- `description` (string) - Description
- `director` (string) - Director
- `genres` (array) - Genres
- `id` (number) - Unique ID
- `name` (string) - Name
- `runtime` (string) - Runtime
- `showtimes` (array) - Non-theater specific showtimes
- `theaters` (array) - Theaters the movie is currently showing in
- `uri` (string) - Movie URI
- `urls` (object) - Urls
- `imdb` (string) - IMDB URL
- `tickets` (string) - Tickets URL
- `trailer` (string) - Trailer URL
+ Response 400 (application/json)
There are 2 ways that this status code can be encountered.
* If there is a problem with the request.
* If the IMDB URL could not be validated.
+ Response 404 (application/json)

### Delete a movie. [DELETE]
This action requires a bearer token with `delete` scope.

+ Parameters
+ `id` (integer, required) - Movie ID
+ Response 204 (application/json)
+ Response 404 (application/json)

## Movies [/movies]
Information on a specific movie.

### Get movies. [GET]
+ Request
+ Attributes
- `location` (string, required) - Location you want movies for.
+ Response 200 (application/json)
+ Attributes
- `cast` (array) - Cast
- `content_rating` (enum[string]) - MPAA rating
+ Members
+ `G`
+ `PG`
+ `PG-13`
+ `R`
+ `NC-17`
+ `X`
+ `NR`
+ `UR`
- `description` (string) - Description
- `director` (string) - Director
- `genres` (array) - Genres
- `id` (number) - Unique ID
- `name` (string) - Name
- `runtime` (string) - Runtime
- `showtimes` (array) - Non-theater specific showtimes
- `theaters` (array) - Theaters the movie is currently showing in
- `uri` (string) - Movie URI
- `urls` (object) - Urls
- `imdb` (string) - IMDB URL
- `tickets` (string) - Tickets URL
- `trailer` (string) - Trailer URL
+ Response 400 (application/json)

### Create a movie. [POST]
This action requires a bearer token with `create` scope.

+ Request
+ Attributes
- `name` (string, required) - Name of the movie.
- `description` (string, required) - Description, or tagline, for the movie.
- `runtime` (string) - Movie runtime, in `HHhr MMmin` format.
- `content_rating` (enum[string]) - MPAA rating
+ Members
+ `G`
+ `PG`
+ `PG-13`
+ `R`
+ `NC-17`
+ `X`
+ `NR`
+ `UR`
- `genres` (string) - Array of movie genres.
- `director` (string) - Name of the director.
- `cast` (string) - Array of names of the cast.
- `imdb` (string) - IMDB URL
- `trailer` (string) - Trailer URL
+ Response 200 (application/json)
+ Attributes
- `cast` (array) - Cast
- `content_rating` (enum[string]) - MPAA rating
+ Members
+ `G`
+ `PG`
+ `PG-13`
+ `R`
+ `NC-17`
+ `X`
+ `NR`
+ `UR`
- `description` (string) - Description
- `director` (string) - Director
- `genres` (array) - Genres
- `id` (number) - Unique ID
- `name` (string) - Name
- `runtime` (string) - Runtime
- `showtimes` (array) - Non-theater specific showtimes
- `theaters` (array) - Theaters the movie is currently showing in
- `uri` (string) - Movie URI
- `urls` (object) - Urls
- `imdb` (string) - IMDB URL
- `tickets` (string) - Tickets URL
- `trailer` (string) - Trailer URL
+ Response 400 (application/json)
There are 2 ways that this status code can be encountered.
* If there is a problem with the request.
* If the IMDB URL could not be validated.
87 changes: 87 additions & 0 deletions resources/examples/Showtimes/blueprints/1.1.1/Theaters.apib
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
FORMAT: 1A

# Theaters
## Movie Theaters [/theaters/{id}]
Information on a specific movie theater.

### Get a single movie theater [GET]
+ Parameters
+ `id` (integer, required) - Theater ID
+ Response 200 (application/json)
+ Attributes
- `address` (string) - Address
- `id` (number) - Unique ID
- `movies` (array) - Movies currently playing
- `name` (string) - Name
- `phone_number` (string) - Phone number
- `showtimes` (array) - Non-movie specific showtimes
- `uri` (string) - Theater URI
+ Response 304 (application/json)
+ Response 404 (application/json)

### Update a movie theater [PATCH]
This action requires a bearer token with `create` scope.

+ Parameters
+ `id` (integer, required) - Theater ID
+ Request
+ Attributes
- `name` (string, required) - Name of the theater.
- `address` (string, required) - Theater address
- `phone_number` (string, required) - Theater phone number
+ Response 200 (application/json)
+ Attributes
- `address` (string) - Address
- `id` (number) - Unique ID
- `movies` (array) - Movies currently playing
- `name` (string) - Name
- `phone_number` (string) - Phone number
- `showtimes` (array) - Non-movie specific showtimes
- `uri` (string) - Theater URI
+ Response 400 (application/json)
+ Response 404 (application/json)

### Delete a movie movie. [DELETE]
This action requires a bearer token with `delete` scope.

+ Parameters
+ `id` (integer, required) - Theater ID
+ Response 204 (application/json)
+ Response 404 (application/json)

## Movie Theaters [/theaters]
Information on a specific movie theater.

### Get movie theaters. [GET]
+ Request
+ Attributes
- `location` (string, required) - Location you want theaters in.
+ Response 200 (application/json)
+ Attributes
- `address` (string) - Address
- `id` (number) - Unique ID
- `movies` (array) - Movies currently playing
- `name` (string) - Name
- `phone_number` (string) - Phone number
- `showtimes` (array) - Non-movie specific showtimes
- `uri` (string) - Theater URI
+ Response 400 (application/json)

### Create a movie theater. [POST]
This action requires a bearer token with `create` scope.

+ Request
+ Attributes
- `name` (string, required) - Name of the theater.
- `address` (string, required) - Theater address
- `phone_number` (string, required) - Theater phone number
+ Response 200 (application/json)
+ Attributes
- `address` (string) - Address
- `id` (number) - Unique ID
- `movies` (array) - Movies currently playing
- `name` (string) - Name
- `phone_number` (string) - Phone number
- `showtimes` (array) - Non-movie specific showtimes
- `uri` (string) - Theater URI
+ Response 400 (application/json)
1 change: 0 additions & 1 deletion resources/examples/Showtimes/blueprints/1.1/Movies.apib
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ This action requires a bearer token with `edit` scope.
+ `NR`
+ `UR`
- `genres` (string) - Array of movie genres.
- `imdb` (string) - IMDB URL
- `trailer` (string) - Trailer URL
- `director` (string) - Name of the director.
- `cast` (string) - Array of names of the cast.
Expand Down
3 changes: 2 additions & 1 deletion resources/examples/mill.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
>
<versions>
<version name="1.0" />
<version name="1.1" default="true" />
<version name="1.1" />
<version name="1.1.1" default="true" />
</versions>

<controllers>
Expand Down
3 changes: 2 additions & 1 deletion tests/Command/GenerateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public function testGenerate()
'.',
'..',
'1.0',
'1.1'
'1.1',
'1.1.1'
], scandir($output_dir));

$blueprints_dir = __DIR__ . '/../../resources/examples/Showtimes/blueprints';
Expand Down
7 changes: 4 additions & 3 deletions tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ public function testLoadFromXML()
$config = $this->getConfig();

$this->assertSame('1.0', $config->getFirstApiVersion());
$this->assertSame('1.1', $config->getDefaultApiVersion());
$this->assertSame('1.1', $config->getLatestApiVersion());
$this->assertSame('1.1.1', $config->getDefaultApiVersion());
$this->assertSame('1.1.1', $config->getLatestApiVersion());

$this->assertSame([
'1.0',
'1.1'
'1.1',
'1.1.1'
], $config->getApiVersions());

$this->assertSame([
Expand Down
Loading