Skip to content

Commit

Permalink
adds another route test
Browse files Browse the repository at this point in the history
  • Loading branch information
datengraben committed Jul 23, 2023
1 parent 0e37241 commit 2845a46
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 6 deletions.
13 changes: 13 additions & 0 deletions tests/API/GBFS/DiscoveryRouteTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace CommonsBooking\Tests\API\GBFS;

use CommonsBooking\Tests\API\CB_REST_Route_UnitTestCase;

/**
* TODO: add result unit test
*/
class DiscoveryRouteTest extends CB_REST_Route_UnitTestCase {

protected $ENDPOINT = '/commonsbooking/v1/gbfs.json';
}
13 changes: 13 additions & 0 deletions tests/API/GBFS/StationInformationRouteTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace CommonsBooking\Tests\API\GBFS;

use CommonsBooking\Tests\API\CB_REST_Route_UnitTestCase;

/**
* TODO: add result unit test
*/
class StationInformationRouteTest extends CB_REST_Route_UnitTestCase {

protected $ENDPOINT = '/commonsbooking/v1/station_information.json';
}
13 changes: 13 additions & 0 deletions tests/API/GBFS/StationStatusRouteTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace CommonsBooking\Tests\API\GBFS;

use CommonsBooking\Tests\API\CB_REST_Route_UnitTestCase;

/**
* TODO: add result unit test
*/
class StationStatusRouteTest extends CB_REST_Route_UnitTestCase {

protected $ENDPOINT = '/commonsbooking/v1/station_status.json';
}
13 changes: 13 additions & 0 deletions tests/API/GBFS/SystemInformationRouteTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace CommonsBooking\Tests\API\GBFS;

use CommonsBooking\Tests\API\CB_REST_Route_UnitTestCase;

/**
* TODO: add result unit test
*/
class SystemInformationRouteTest extends CB_REST_Route_UnitTestCase {

protected $ENDPOINT = '/commonsbooking/v1/system_information.json';
}
10 changes: 10 additions & 0 deletions tests/API/ItemsRouteTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace CommonsBooking\Tests\API;

/**
* TODO: add route result test case
*/
class ItemsRouteTest extends CB_REST_Route_UnitTestCase {
protected $ENDPOINT = '/commonsbooking/v1/items';
}
11 changes: 11 additions & 0 deletions tests/API/LocationsRouteTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace CommonsBooking\Tests\API;

/**
* TODO: add route result test case
*/
class LocationsRouteTest extends CB_REST_Route_UnitTestCase {

protected $ENDPOINT = '/commonsbooking/v1/locations';
}
11 changes: 11 additions & 0 deletions tests/API/ProjectsRouteTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace CommonsBooking\Tests\API;

/**
* TODO: add route result test case
*/
class ProjectsRouteTest extends CB_REST_Route_UnitTestCase {

protected $ENDPOINT = '/commonsbooking/v1/projects';
}
14 changes: 8 additions & 6 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@
// Give access to tests_add_filter() function.
require_once "{$_tests_dir}/includes/functions.php";

/**
* Manually load the plugin being tested.
*/
function _manually_load_plugin() {
require dirname( dirname( __FILE__ ) ) . '/commonsbooking.php';
if ( ! function_exists( '_manually_load_plugin' ) ) {
/**
* Manually load the plugin being tested.
*/
function _manually_load_plugin() {
require dirname( dirname( __FILE__ ) ) . '/commonsbooking.php';
}
}

tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

require_once dirname( __FILE__, 2 ) . '/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';

// Start up the WP testing environment.
require "{$_tests_dir}/includes/bootstrap.php";
require_once "{$_tests_dir}/includes/bootstrap.php";

0 comments on commit 2845a46

Please sign in to comment.