From 34ffdae4fe8f1a1d9a59e695b2da36b78e57b8c9 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 11 Nov 2017 13:09:30 +0100 Subject: [PATCH] Fix tests according to branch 'api-refactor' --- spec/build/api/core/ModuleFactorySpec.php | 4 +- spec/build/api/core/RequestSpec.php | 46 +++++++++++------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/spec/build/api/core/ModuleFactorySpec.php b/spec/build/api/core/ModuleFactorySpec.php index 07342e4..7b2ac6b 100644 --- a/spec/build/api/core/ModuleFactorySpec.php +++ b/spec/build/api/core/ModuleFactorySpec.php @@ -67,9 +67,9 @@ allow('file_exists')->toBeCalled()->andReturn(true); // normally the 'module' module is always here for testing purposes - $err = ModuleFactory::getModule('module'); + $err = ModuleFactory::getModule('documentationDefault'); - expect($err)->not->toBeAnInstanceOf('\\error\\core\\Error'); + expect($err)->not->toBeAnInstanceOf("\\error\\core\\Error"); }); diff --git a/spec/build/api/core/RequestSpec.php b/spec/build/api/core/RequestSpec.php index ab5849c..e63dfb2 100644 --- a/spec/build/api/core/RequestSpec.php +++ b/spec/build/api/core/RequestSpec.php @@ -274,7 +274,7 @@ it('fail when unknown method', function(){ allow('json_decode')->toBeCalled()->andReturn([ - 'mo-du_leA' => [ 'POST::me-th_odA' => [] ], + 'mo-du_leA' => [ 'me-th_odA' => [] ], 'moduleB' => [] ]); @@ -299,7 +299,7 @@ allow(Request::class)->toReceive('buildOptions')->andReturn(true); allow('json_decode')->toBeCalled()->andReturn([ - 'mo-du_leA' => [ 'POST::me-th_odA' => [] ], + 'mo-du_leA' => [ 'me-th_odA' => [] ], 'moduleB' => [] ]); @@ -320,7 +320,7 @@ allow('json_decode')->toBeCalled()->andReturn([ 'moduleA' => [ - 'POST::methodA' => [] + 'methodA' => [] ] ]); @@ -338,7 +338,7 @@ allow('json_decode')->toBeCalled()->andReturn([ 'moduleA' => [ - 'POST::methodA' => [ + 'methodA' => [ 'permissions' => 23.2 ] ] @@ -358,7 +358,7 @@ allow('json_decode')->toBeCalled()->andReturn([ 'moduleA' => [ - 'POST::methodA' => [ + 'methodA' => [ 'permissions' => [] ] ] @@ -381,7 +381,7 @@ allow('json_decode')->toBeCalled()->andReturn([ 'moduleA' => [ - 'POST::methodA' => [ + 'methodA' => [ 'permissions' => ['a'] ] ] @@ -400,7 +400,7 @@ allow('json_decode')->toBeCalled()->andReturn([ 'moduleA' => [ - 'POST::methodA' => [ + 'methodA' => [ 'permissions' => ['a'] ] ] @@ -420,7 +420,7 @@ allow('json_decode')->toBeCalled()->andReturn([ 'moduleA' => [ - 'POST::methodA' => [ + 'methodA' => [ 'permissions' => ['a'] ] ] @@ -466,7 +466,7 @@ $this->json = [ 'moduleA' => [ - 'POST::methodA' => [] + 'methodA' => [] ] ]; @@ -499,7 +499,7 @@ it('fail if \'parameters\' has no name', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 1 => [] ]; allow('json_decode')->toBeCalled()->andReturn($this->json); @@ -511,7 +511,7 @@ it('fail if \'parameters\' has no specification', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => 1 ]; allow('json_decode')->toBeCalled()->andReturn($this->json); @@ -523,7 +523,7 @@ it('fail if one \'parameters\' have no \'type\' clause', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'optional' => false ] @@ -537,7 +537,7 @@ it('fail if one \'parameters\' have incorrect \'type\' clause', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'optional' => false, 'type' => 12 @@ -556,7 +556,7 @@ it('pass if missing optional parameter -> set to null by default', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'optional' => true, 'type' => 'text' @@ -576,7 +576,7 @@ it('fail if optional param wrong type ', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'optional' => true, 'type' => 'id' @@ -592,7 +592,7 @@ it('pass if optional param matching type ', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'optional' => true, 'type' => 'id' @@ -608,7 +608,7 @@ it('fail if required param missing ', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'optional' => false, 'type' => 'id' @@ -623,7 +623,7 @@ it('fail if required param wrong type ', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'optional' => false, 'type' => 'id' @@ -639,7 +639,7 @@ it('pass if required param matching type ', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'optional' => false, 'type' => 'id' @@ -659,7 +659,7 @@ it('fail if FILE param required + file does not exist', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'type' => 'FILE' ] @@ -674,7 +674,7 @@ it('pass if FILE param required + file exists -> create ref', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'type' => 'FILE' ] @@ -694,7 +694,7 @@ it('pass if FILE optional param missing -> null', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'optional' => true, 'type' => 'FILE' @@ -715,7 +715,7 @@ it('pass if FILE optional param + file exists -> create ref', function(){ - $this->json['moduleA']['POST::methodA']['parameters'] = [ + $this->json['moduleA']['methodA']['parameters'] = [ 'paramName' => [ 'optional' => true, 'type' => 'FILE'