Fix tests according to branch 'api-refactor'

This commit is contained in:
xdrm-brackets 2017-11-11 13:09:30 +01:00
parent 6b9bd03d9e
commit 34ffdae4fe
2 changed files with 25 additions and 25 deletions

View File

@ -67,9 +67,9 @@
allow('file_exists')->toBeCalled()->andReturn(true); allow('file_exists')->toBeCalled()->andReturn(true);
// normally the 'module' module is always here for testing purposes // 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");
}); });

View File

@ -274,7 +274,7 @@
it('fail when unknown method', function(){ it('fail when unknown method', function(){
allow('json_decode')->toBeCalled()->andReturn([ allow('json_decode')->toBeCalled()->andReturn([
'mo-du_leA' => [ 'POST::me-th_odA' => [] ], 'mo-du_leA' => [ 'me-th_odA' => [] ],
'moduleB' => [] 'moduleB' => []
]); ]);
@ -299,7 +299,7 @@
allow(Request::class)->toReceive('buildOptions')->andReturn(true); allow(Request::class)->toReceive('buildOptions')->andReturn(true);
allow('json_decode')->toBeCalled()->andReturn([ allow('json_decode')->toBeCalled()->andReturn([
'mo-du_leA' => [ 'POST::me-th_odA' => [] ], 'mo-du_leA' => [ 'me-th_odA' => [] ],
'moduleB' => [] 'moduleB' => []
]); ]);
@ -320,7 +320,7 @@
allow('json_decode')->toBeCalled()->andReturn([ allow('json_decode')->toBeCalled()->andReturn([
'moduleA' => [ 'moduleA' => [
'POST::methodA' => [] 'methodA' => []
] ]
]); ]);
@ -338,7 +338,7 @@
allow('json_decode')->toBeCalled()->andReturn([ allow('json_decode')->toBeCalled()->andReturn([
'moduleA' => [ 'moduleA' => [
'POST::methodA' => [ 'methodA' => [
'permissions' => 23.2 'permissions' => 23.2
] ]
] ]
@ -358,7 +358,7 @@
allow('json_decode')->toBeCalled()->andReturn([ allow('json_decode')->toBeCalled()->andReturn([
'moduleA' => [ 'moduleA' => [
'POST::methodA' => [ 'methodA' => [
'permissions' => [] 'permissions' => []
] ]
] ]
@ -381,7 +381,7 @@
allow('json_decode')->toBeCalled()->andReturn([ allow('json_decode')->toBeCalled()->andReturn([
'moduleA' => [ 'moduleA' => [
'POST::methodA' => [ 'methodA' => [
'permissions' => ['a'] 'permissions' => ['a']
] ]
] ]
@ -400,7 +400,7 @@
allow('json_decode')->toBeCalled()->andReturn([ allow('json_decode')->toBeCalled()->andReturn([
'moduleA' => [ 'moduleA' => [
'POST::methodA' => [ 'methodA' => [
'permissions' => ['a'] 'permissions' => ['a']
] ]
] ]
@ -420,7 +420,7 @@
allow('json_decode')->toBeCalled()->andReturn([ allow('json_decode')->toBeCalled()->andReturn([
'moduleA' => [ 'moduleA' => [
'POST::methodA' => [ 'methodA' => [
'permissions' => ['a'] 'permissions' => ['a']
] ]
] ]
@ -466,7 +466,7 @@
$this->json = [ $this->json = [
'moduleA' => [ 'moduleA' => [
'POST::methodA' => [] 'methodA' => []
] ]
]; ];
@ -499,7 +499,7 @@
it('fail if \'parameters\' has no <string> name', function(){ it('fail if \'parameters\' has no <string> name', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
1 => [] 1 => []
]; ];
allow('json_decode')->toBeCalled()->andReturn($this->json); allow('json_decode')->toBeCalled()->andReturn($this->json);
@ -511,7 +511,7 @@
it('fail if \'parameters\' has no <array> specification', function(){ it('fail if \'parameters\' has no <array> specification', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => 1 'paramName' => 1
]; ];
allow('json_decode')->toBeCalled()->andReturn($this->json); allow('json_decode')->toBeCalled()->andReturn($this->json);
@ -523,7 +523,7 @@
it('fail if one \'parameters\' have no \'type\' clause', function(){ it('fail if one \'parameters\' have no \'type\' clause', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'optional' => false 'optional' => false
] ]
@ -537,7 +537,7 @@
it('fail if one \'parameters\' have incorrect \'type\' clause', function(){ it('fail if one \'parameters\' have incorrect \'type\' clause', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'optional' => false, 'optional' => false,
'type' => 12 'type' => 12
@ -556,7 +556,7 @@
it('pass if missing optional parameter -> set to null by default', function(){ it('pass if missing optional parameter -> set to null by default', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'optional' => true, 'optional' => true,
'type' => 'text' 'type' => 'text'
@ -576,7 +576,7 @@
it('fail if optional param wrong type ', function(){ it('fail if optional param wrong type ', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'optional' => true, 'optional' => true,
'type' => 'id' 'type' => 'id'
@ -592,7 +592,7 @@
it('pass if optional param matching type ', function(){ it('pass if optional param matching type ', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'optional' => true, 'optional' => true,
'type' => 'id' 'type' => 'id'
@ -608,7 +608,7 @@
it('fail if required param missing ', function(){ it('fail if required param missing ', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'optional' => false, 'optional' => false,
'type' => 'id' 'type' => 'id'
@ -623,7 +623,7 @@
it('fail if required param wrong type ', function(){ it('fail if required param wrong type ', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'optional' => false, 'optional' => false,
'type' => 'id' 'type' => 'id'
@ -639,7 +639,7 @@
it('pass if required param matching type ', function(){ it('pass if required param matching type ', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'optional' => false, 'optional' => false,
'type' => 'id' 'type' => 'id'
@ -659,7 +659,7 @@
it('fail if FILE param required + file does not exist', function(){ it('fail if FILE param required + file does not exist', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'type' => 'FILE' 'type' => 'FILE'
] ]
@ -674,7 +674,7 @@
it('pass if FILE param required + file exists -> create ref', function(){ it('pass if FILE param required + file exists -> create ref', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'type' => 'FILE' 'type' => 'FILE'
] ]
@ -694,7 +694,7 @@
it('pass if FILE optional param missing -> null', function(){ it('pass if FILE optional param missing -> null', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'optional' => true, 'optional' => true,
'type' => 'FILE' 'type' => 'FILE'
@ -715,7 +715,7 @@
it('pass if FILE optional param + file exists -> create ref', function(){ it('pass if FILE optional param + file exists -> create ref', function(){
$this->json['moduleA']['POST::methodA']['parameters'] = [ $this->json['moduleA']['methodA']['parameters'] = [
'paramName' => [ 'paramName' => [
'optional' => true, 'optional' => true,
'type' => 'FILE' 'type' => 'FILE'