Skip to content

Commit

Permalink
[Update] Fixes after fork
Browse files Browse the repository at this point in the history
- Renamed namespaces
- Updated package versions compatible only for laravel 7.0 & above
- changed config('api-tester.enabled') value to env('API_TESTER')
- Fixed asvae#50 (comment)
- Fixed asvae#49 (comment)
  • Loading branch information
craftisan committed Sep 22, 2020
1 parent 54a8e2d commit a718dba
Show file tree
Hide file tree
Showing 41 changed files with 332 additions and 294 deletions.
16 changes: 8 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/.idea/
/node_modules/
/vendor/
/composer.lock
.idea/
node_modules/
vendor/
composer.lock
*.map
/resources/assets/tmp/

/phpunit.bat
/tests/tmp/
resources/assets/tmp/
.phpunit.result.cache
phpunit.bat
tests/tmp/
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
[![Unit tests](https://travis-ci.org/asvae/laravel-api-tester.svg?branch=master)](https://travis-ci.org/asvae/laravel-api-tester)
[![PHP version](https://badge.fury.io/ph/asvae%2Flaravel-api-tester.svg)](https://badge.fury.io/ph/asvae%2Flaravel-api-tester)

#####Forked from https://github.com/asvae/laravel-api-tester

![Interface](http://i.imgur.com/3geJtzb.png)

## Live demo
Expand All @@ -19,13 +21,13 @@ Those are short and easy to read. Take a look.
Require this package with composer:

```
composer require asvae/laravel-api-tester
composer require craftisan/laravel-api-tester
```

After updating composer, add the ServiceProvider to the providers array in config/app.php

```
Asvae\ApiTester\ServiceProvider::class,
Craftisan\ApiTester\ServiceProvider::class,
```

That's it. Go to `[your site]/api-tester` and start testing routes. It works for Laravel 5.1+.
Expand All @@ -35,7 +37,7 @@ That's it. Go to `[your site]/api-tester` and start testing routes. It works fo
By default, the package is bound to `APP_DEBUG` `.env` value. But you can easily override it. Just publish config:

```
php artisan vendor:publish --provider="Asvae\ApiTester\ServiceProvider"
php artisan vendor:publish --provider="Craftisan\ApiTester\ServiceProvider"
```

And edit `config/api-tester.php` as you please.
Expand Down
26 changes: 16 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
{
"name": "asvae/laravel-api-tester",
"name": "craftisan/laravel-api-tester",
"description": "Api tester for Laravel Framework",
"keywords": ["laravel", "api", "debug"],
"keywords": [
"laravel",
"api",
"debug",
"laravel api tester"
],
"license": "MIT",
"authors": [
{
"name": "Yauheni Prakopchyk",
"email": "ontrew@gmail.com"
"name": "Deekshant Joshi",
"email": "deekshant.joshi@gmail.com"
}
],
"require": {
"php": ">=5.4.0"
"php": "^7.2.5",
"ext-json": "*"
},
"require-dev": {
"laravel/framework": "5.2.*",
"phpunit/phpunit": "~4.0",
"mockery/mockery": "^0.9.5"
"laravel/framework": "^7.0",
"phpunit/phpunit": "^8.5",
"mockery/mockery": "^1.3.1"
},
"suggest": {
"ktamas77/firebase-php": "Keep your requests stored in cloud",
Expand All @@ -28,13 +34,13 @@
},
"autoload": {
"psr-4": {
"Asvae\\ApiTester\\": "src/"
"Craftisan\\ApiTester\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Asvae\\ApiTester\\ServiceProvider"
"Craftisan\\ApiTester\\ServiceProvider"
]
}
}
Expand Down
29 changes: 13 additions & 16 deletions config/api-tester.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
|
*/

'enabled' => env('APP_DEBUG', false),

'enabled' => env('API_TESTER', false),

/*
|--------------------------------------------------------------------------
Expand All @@ -27,7 +26,6 @@

'route' => 'api-tester',


/*
|--------------------------------------------------------------------------
| Middleware
Expand Down Expand Up @@ -59,7 +57,6 @@

'route_meta' => true,


/*
|--------------------------------------------------------------------------
| Request analysis
Expand Down Expand Up @@ -123,8 +120,8 @@
*/

'route_repositories' => [
Asvae\ApiTester\Repositories\RouteLaravelRepository::class,
//Asvae\ApiTester\Repositories\RouteDingoRepository::class,
Craftisan\ApiTester\Repositories\RouteLaravelRepository::class,
//Craftisan\ApiTester\Repositories\RouteDingoRepository::class,
],

/*
Expand All @@ -135,13 +132,13 @@
|
*/

'request_repository' => Asvae\ApiTester\Repositories\RequestRepository::class,
'request_repository' => Craftisan\ApiTester\Repositories\RequestRepository::class,

/*
|--------------------------------------------------------------------------
| Asvae\ApiTester\Repositories\RequestRepository configuration
| Craftisan\ApiTester\Repositories\RequestRepository configuration
|--------------------------------------------------------------------------
| This config matters only when using Asvae\ApiTester\Repositories\RequestRepository
| This config matters only when using Craftisan\ApiTester\Repositories\RequestRepository
| or similar implementations.
|
*/
Expand All @@ -150,21 +147,21 @@

'storage_drivers' => [
'file' => [
'class' => Asvae\ApiTester\Storages\JsonStorage::class,
'class' => Craftisan\ApiTester\Storages\JsonStorage::class,
'options' => [
'path' => 'storage/api-tester/requests.db'
]
'path' => 'storage/api-tester/requests.db',
],
],
'firebase' => [
'class' => Asvae\ApiTester\Storages\FireBaseStorage::class,
'class' => Craftisan\ApiTester\Storages\FireBaseStorage::class,
'options' => [
'base' => env('API_TESTER_FIREBASE_ADDRESS', 'https://example.firebaseio.com/api-tester/'),
],
'token' => [
'secret' => env('API_TESTER_FIREBASE_SECRET', '<your-secret-api-key>'),
'options' => ['admin' => true],
'data' => [],
]
]
]
],
],
],
];
2 changes: 1 addition & 1 deletion resources/assets/build/api-tester.js

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions resources/assets/js/api-tester.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Application main page.
<div class="nav-right">
<a class="nav-item"
title="Github"
href="https://github.com/asvae/laravel-api-tester"
href="https://github.com/craftisan/laravel-api-tester"
target="_blank"
>
<i class="fa fa-github nav-icon"></i>
Expand All @@ -27,14 +27,14 @@ Application main page.
</a>
<a class="nav-item"
title="Fork me"
href="https://github.com/asvae/laravel-api-tester/fork"
href="https://github.com/craftisan/laravel-api-tester/fork"
target="_blank"
>
<i class="fa fa-code-fork nav-icon"></i>
</a>
<a class="nav-item"
title="Issues"
href="https://github.com/asvae/laravel-api-tester/issues"
href="https://github.com/craftisan/laravel-api-tester/issues"
target="_blank"
>
<i class="fa fa-bug nav-icon"></i>
Expand All @@ -58,17 +58,17 @@ Application main page.
</template>

<script>
import vmListsBlock from './components/lists-block/lists-block.vue'
import vmActionPanel from './components/action-panel/action-panel.vue'
import vmRequestPoster from './components/edit-block/edit-block.vue'
import vmListsBlock from './components/lists-block/lists-block.vue'
import vmActionPanel from './components/action-panel/action-panel.vue'
import vmRequestPoster from './components/edit-block/edit-block.vue'
export default {
components: {
vmActionPanel,
vmListsBlock,
vmRequestPoster,
},
}
export default {
components: {
vmActionPanel,
vmListsBlock,
vmRequestPoster,
},
}
</script>

We decided to forsake all the mobile support stuff. It requires bulma @media
Expand Down
16 changes: 9 additions & 7 deletions src/Collections/RequestCollection.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace Asvae\ApiTester\Collections;
namespace Craftisan\ApiTester\Collections;

use Asvae\ApiTester\Entities\RequestEntity;
use Craftisan\ApiTester\Entities\RequestEntity;
use Illuminate\Support\Collection;

/**
* Class RequestCollection
*
* @package \Asvae\ApiTester
* @package \Craftisan\ApiTester
*/
class RequestCollection extends Collection
{
Expand All @@ -18,7 +18,7 @@ class RequestCollection extends Collection
*
* @param string $id
*
* @return \Asvae\ApiTester\Entities\RequestEntity|null
* @return \Craftisan\ApiTester\Entities\RequestEntity|null
*/
public function find($id)
{
Expand All @@ -28,9 +28,9 @@ public function find($id)
/**
* Put new RequestEntity to collection.
*
* @param \Asvae\ApiTester\Entities\RequestEntity $request
* @param \Craftisan\ApiTester\Entities\RequestEntity $request
*
* @return \Asvae\ApiTester\Entities\RequestEntity
* @return \Craftisan\ApiTester\Entities\RequestEntity
*/
public function insert(RequestEntity $request)
{
Expand All @@ -43,6 +43,7 @@ public function insert(RequestEntity $request)
* Load data to collection.
*
* @param $data
*
* @return static
*/
public function load($data)
Expand Down Expand Up @@ -78,7 +79,8 @@ public function onlyDiff()
*
* @return static
*/
public function onlyNotMarkedToDelete(){
public function onlyNotMarkedToDelete()
{
return $this->filter(function (RequestEntity $request) {
return $request->notMarkedToDelete();
});
Expand Down
15 changes: 8 additions & 7 deletions src/Collections/RouteCollection.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<?php

namespace Asvae\ApiTester\Collections;
namespace Craftisan\ApiTester\Collections;

use Illuminate\Support\Collection;

/**
* Class RouteCollection
*
* @package \Asvae\ApiTester
* @package \Craftisan\ApiTester
*/
class RouteCollection extends Collection
{

/**
* Include routes that match patterns.
*
Expand Down Expand Up @@ -42,7 +43,6 @@ public function filterMatch($patterns)
});
}


/**
* Exclude routes that match patterns.
*
Expand All @@ -64,22 +64,23 @@ public function filterExcept($patterns = [])
/**
* @param array $route
* @param array $pattern
*
* @return bool
*/
private function isRouteMatchesPattern(array $route, array $pattern)
{
foreach ($route as $key => $value) {
if (! array_key_exists($key, $pattern)) {
if (!array_key_exists($key, $pattern)) {
continue;
}

if(is_array($value)){
if (is_array($value)) {
$value = implode(',', $value);
}

$regex = '#'.$pattern[$key].'#';
$regex = '#' . $pattern[$key] . '#';

return ! ! preg_match($regex, $value);
return !!preg_match($regex, $value);
}

return true;
Expand Down
11 changes: 6 additions & 5 deletions src/Contracts/RequestRepositoryInterface.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<?php

namespace Asvae\ApiTester\Contracts;
namespace Craftisan\ApiTester\Contracts;

use Asvae\ApiTester\Entities\RequestEntity;
use Craftisan\ApiTester\Entities\RequestEntity;

interface RequestRepositoryInterface
{

/**
* @param $id
*
* @return \Asvae\ApiTester\Entities\RequestEntity
* @return \Craftisan\ApiTester\Entities\RequestEntity
*/
public function find($id);

/**
* @param \Asvae\ApiTester\Entities\RequestEntity $request
* @param \Craftisan\ApiTester\Entities\RequestEntity $request
*
* @return void
*/
Expand All @@ -28,7 +29,7 @@ public function persist(RequestEntity $request);
public function exists($id);

/**
* @return \Asvae\ApiTester\Collections\RequestCollection|\Asvae\ApiTester\Entities\RequestEntity[]
* @return \Craftisan\ApiTester\Collections\RequestCollection|\Craftisan\ApiTester\Entities\RequestEntity[]
*/
public function all();

Expand Down
Loading

0 comments on commit a718dba

Please sign in to comment.