@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | private $repository; |
| 42 | 42 | |
| 43 | - private $inheritance = [ Paginator::class ]; |
|
| 43 | + private $inheritance = [Paginator::class]; |
|
| 44 | 44 | |
| 45 | 45 | private function getTargetArgs() |
| 46 | 46 | { |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | $qb = $this->getMockBuilder(Builder::class)->disableOriginalConstructor()->setMethods(['field', 'equals', 'getQuery'])->getMock(); |
| 62 | 62 | $qb->expects($this->once())->method('field')->with('title')->will($this->returnSelf()); |
| 63 | 63 | $qb->expects($this->once())->method('equals')->with( |
| 64 | - $this->callback(function ($value) use ($q) { |
|
| 65 | - return $value instanceof \MongoRegex && (String) $value == '/' . $q . '/i'; |
|
| 64 | + $this->callback(function($value) use ($q) { |
|
| 65 | + return $value instanceof \MongoRegex && (String) $value == '/'.$q.'/i'; |
|
| 66 | 66 | }) |
| 67 | 67 | ); |
| 68 | 68 | $cursor = $this->getMockBuilder(\Doctrine\ODM\MongoDB\Cursor::class)->disableOriginalConstructor()->getMock(); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'getTargetArgs', |
| 40 | 40 | ]; |
| 41 | 41 | |
| 42 | - private $inheritance = [ AbstractPaginationQuery::class ]; |
|
| 42 | + private $inheritance = [AbstractPaginationQuery::class]; |
|
| 43 | 43 | |
| 44 | 44 | private function getTargetArgs() |
| 45 | 45 | { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | $this->user = $user; |
| 63 | - return [ $user ]; |
|
| 63 | + return [$user]; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function testDefaultPropertyValues() |
@@ -92,29 +92,29 @@ discard block |
||
| 92 | 92 | $exprExpects = []; |
| 93 | 93 | |
| 94 | 94 | if ('search' == $mode || true === $mode) { |
| 95 | - $exprExpects['operator'][] = [ 'with' => ['$text', ['$search' => strtolower($params['search'])]]]; |
|
| 96 | - $exprExpects['getQuery'][] = [ 'return' => 'exprQuery' ]; |
|
| 97 | - $qbExpects['field'][] = [ 'with' => [null]]; |
|
| 98 | - $qbExpects['equals'][] = [ 'with' => ['exprQuery']]; |
|
| 95 | + $exprExpects['operator'][] = ['with' => ['$text', ['$search' => strtolower($params['search'])]]]; |
|
| 96 | + $exprExpects['getQuery'][] = ['return' => 'exprQuery']; |
|
| 97 | + $qbExpects['field'][] = ['with' => [null]]; |
|
| 98 | + $qbExpects['equals'][] = ['with' => ['exprQuery']]; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | if ('location' == $mode || true === $mode) { |
| 102 | 102 | $coords = $params['l']->getCoordinates()->getCoordinates(); |
| 103 | 103 | $qbExpects['field'][] = ['with' => ['preferredJob.desiredLocations.coordinates']]; |
| 104 | - $qbExpects['geoWithinCenter'][] = ['with' => [$coords[0], $coords[1],(float)$params['d'] / 100]]; |
|
| 104 | + $qbExpects['geoWithinCenter'][] = ['with' => [$coords[0], $coords[1], (float) $params['d'] / 100]]; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - $exprExpects['field'][] = [ 'with' => ['permissions.view']]; |
|
| 108 | - $exprExpects['equals'][] = [ 'with' => [ $this->user->getId()]]; |
|
| 109 | - $exprExpects['field'][] = [ 'with' => ['status.name']]; |
|
| 110 | - $exprExpects['equals'][] = [ 'with' => [Status::PUBLIC_TO_ALL]]; |
|
| 107 | + $exprExpects['field'][] = ['with' => ['permissions.view']]; |
|
| 108 | + $exprExpects['equals'][] = ['with' => [$this->user->getId()]]; |
|
| 109 | + $exprExpects['field'][] = ['with' => ['status.name']]; |
|
| 110 | + $exprExpects['equals'][] = ['with' => [Status::PUBLIC_TO_ALL]]; |
|
| 111 | 111 | |
| 112 | - $qbExpects['addOr'][] = [ 'with' => [$expr] ]; |
|
| 113 | - $qbExpects['addOr'][] = [ 'with' => [$expr] ]; |
|
| 112 | + $qbExpects['addOr'][] = ['with' => [$expr]]; |
|
| 113 | + $qbExpects['addOr'][] = ['with' => [$expr]]; |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | |
| 117 | - $configureMock = function ($mock, $expects) { |
|
| 117 | + $configureMock = function($mock, $expects) { |
|
| 118 | 118 | foreach ($expects as $method => $spec) { |
| 119 | 119 | $count = count($spec); |
| 120 | 120 | $with = []; |
@@ -141,15 +141,15 @@ discard block |
||
| 141 | 141 | public function provideCreateQueryTestData() |
| 142 | 142 | { |
| 143 | 143 | $loc = new Location(); |
| 144 | - $loc->setCoordinates(new Point([1,1])); |
|
| 144 | + $loc->setCoordinates(new Point([1, 1])); |
|
| 145 | 145 | return [ |
| 146 | 146 | |
| 147 | - 'woParams' => [ null, null ], |
|
| 148 | - 'emptySearch' => [ null, ['search' => '']], |
|
| 149 | - 'search' => [ 'search', ['search' => 'MusBeLowerCase']], |
|
| 150 | - 'emptyLocation' => [ null, ['l' => new Location()]], |
|
| 151 | - 'location' => [ 'location', ['l' => $loc, 'd' => 10]], |
|
| 152 | - 'all' => [ true, ['search' => 'MustLowerThisOneToo', 'l' => $loc, 'd' => 5]], |
|
| 147 | + 'woParams' => [null, null], |
|
| 148 | + 'emptySearch' => [null, ['search' => '']], |
|
| 149 | + 'search' => ['search', ['search' => 'MusBeLowerCase']], |
|
| 150 | + 'emptyLocation' => [null, ['l' => new Location()]], |
|
| 151 | + 'location' => ['location', ['l' => $loc, 'd' => 10]], |
|
| 152 | + 'all' => [true, ['search' => 'MustLowerThisOneToo', 'l' => $loc, 'd' => 5]], |
|
| 153 | 153 | |
| 154 | 154 | ]; |
| 155 | 155 | } |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | private $target = PaginationQueryFactory::class; |
| 39 | 39 | |
| 40 | - private $inheritance = [ FactoryInterface::class ]; |
|
| 40 | + private $inheritance = [FactoryInterface::class]; |
|
| 41 | 41 | |
| 42 | 42 | public function provideUser() |
| 43 | 43 | { |
| 44 | 44 | return [ |
| 45 | - [ null ], |
|
| 46 | - [ new User() ], |
|
| 45 | + [null], |
|
| 46 | + [new User()], |
|
| 47 | 47 | ]; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $services = $this->createServiceManagerMock( |
| 78 | - ['AuthenticationService' => $auth ] |
|
| 78 | + ['AuthenticationService' => $auth] |
|
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | 81 | $paginators = $this->createPluginManagerMock([], $services); |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | '@testCreateServiceProxiesToInvokeAndPassServiceManager' => VCF_Mock::class, |
| 37 | 37 | ]; |
| 38 | 38 | |
| 39 | - private $inheritance = [ FactoryInterface::class ]; |
|
| 39 | + private $inheritance = [FactoryInterface::class]; |
|
| 40 | 40 | |
| 41 | 41 | public function provideCreateServiceTestData() |
| 42 | 42 | { |
| 43 | 43 | return [ |
| 44 | - [ 'requestedName' ], |
|
| 45 | - [ null ], |
|
| 44 | + ['requestedName'], |
|
| 45 | + [null], |
|
| 46 | 46 | ]; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $repositories = $this |
| 68 | 68 | ->createPluginManagerMock( |
| 69 | 69 | [ |
| 70 | - 'Cv/Cv' => [ 'service' => $repository, 'count_get' => 1 ] |
|
| 70 | + 'Cv/Cv' => ['service' => $repository, 'count_get' => 1] |
|
| 71 | 71 | ] |
| 72 | 72 | ) |
| 73 | 73 | ; |
@@ -106,6 +106,6 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | public function __invoke(ContainerInterface $container, $requestedName, array $options = null) |
| 108 | 108 | { |
| 109 | - $this->reqName = is_null($requestedName) ? ViewController::class:$requestedName; |
|
| 109 | + $this->reqName = is_null($requestedName) ? ViewController::class : $requestedName; |
|
| 110 | 110 | } |
| 111 | 111 | } |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | private $target = LanguageSkillCollectionFactory::class; |
| 38 | 38 | |
| 39 | - private $inheritance = [ FactoryInterface::class ]; |
|
| 39 | + private $inheritance = [FactoryInterface::class]; |
|
| 40 | 40 | |
| 41 | 41 | public function testInvokation() |
| 42 | 42 | { |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | |
| 37 | 37 | private $target = EmploymentCollectionFactory::class; |
| 38 | 38 | |
| 39 | - private $inheritance = [ FactoryInterface::class ]; |
|
| 39 | + private $inheritance = [FactoryInterface::class]; |
|
| 40 | 40 | |
| 41 | 41 | public function testInvokation() |
| 42 | 42 | { |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | |
| 38 | 38 | private $target = SkillCollectionFactory::class; |
| 39 | 39 | |
| 40 | - private $inheritance = [ FactoryInterface::class ]; |
|
| 40 | + private $inheritance = [FactoryInterface::class]; |
|
| 41 | 41 | |
| 42 | 42 | public function testInvokation() |
| 43 | 43 | { |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | |
| 36 | 36 | private $target = EducationCollectionFactory::class; |
| 37 | 37 | |
| 38 | - private $inheritance = [ FactoryInterface::class ]; |
|
| 38 | + private $inheritance = [FactoryInterface::class]; |
|
| 39 | 39 | |
| 40 | 40 | public function testInvokation() |
| 41 | 41 | { |
@@ -86,17 +86,17 @@ |
||
| 86 | 86 | [ 'status', ['value' => new Status(), 'default' => new Status() ]], |
| 87 | 87 | [ 'status', ['value' => Status::NONPUBLIC, 'expect' => '@' . Status::class]], |
| 88 | 88 | [ 'status', ['value' => Status::PUBLIC_TO_ALL, 'ignore_getter' => true, |
| 89 | - 'pre' => function () use ($permissions2) { |
|
| 90 | - $this->target->setPermissions($permissions2); |
|
| 91 | - }] |
|
| 89 | + 'pre' => function () use ($permissions2) { |
|
| 90 | + $this->target->setPermissions($permissions2); |
|
| 91 | + }] |
|
| 92 | 92 | ], |
| 93 | 93 | [ 'status', ['value' => Status::NONPUBLIC, 'ignore_getter' => true, |
| 94 | - 'pre' => function () use ($permissions2) { |
|
| 95 | - $this->target->setPermissions($permissions2); |
|
| 96 | - }, |
|
| 97 | - 'post' => function () use ($permissions2) { |
|
| 98 | - $permissions2->__phpunit_verify(); |
|
| 99 | - }] |
|
| 94 | + 'pre' => function () use ($permissions2) { |
|
| 95 | + $this->target->setPermissions($permissions2); |
|
| 96 | + }, |
|
| 97 | + 'post' => function () use ($permissions2) { |
|
| 98 | + $permissions2->__phpunit_verify(); |
|
| 99 | + }] |
|
| 100 | 100 | ], |
| 101 | 101 | [ 'attachments', $defaultOptions], |
| 102 | 102 | [ 'user', ['value' => new User(), 'ignore_getter' => true, |
@@ -39,15 +39,15 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | private $target = Cv::class; |
| 41 | 41 | |
| 42 | - private $inheritance = [ AbstractIdentifiableEntity::class, CvInterface::class, DraftableEntityInterface::class ]; |
|
| 42 | + private $inheritance = [AbstractIdentifiableEntity::class, CvInterface::class, DraftableEntityInterface::class]; |
|
| 43 | 43 | |
| 44 | 44 | public function propertiesProvider() |
| 45 | 45 | { |
| 46 | 46 | $coll = new ArrayCollection(); |
| 47 | 47 | $prefJob = new PreferredJob(); |
| 48 | - $defaultOptions = [ 'default' => $coll, 'value' => $coll ]; |
|
| 49 | - $indexedByOptions = function ($prop) use ($coll) { |
|
| 50 | - return [ $prop, [ 'value' => $coll, 'getter_method' => 'get*IndexedById', 'expect' => '@' . IdentityWrapper::class]]; |
|
| 48 | + $defaultOptions = ['default' => $coll, 'value' => $coll]; |
|
| 49 | + $indexedByOptions = function($prop) use ($coll) { |
|
| 50 | + return [$prop, ['value' => $coll, 'getter_method' => 'get*IndexedById', 'expect' => '@'.IdentityWrapper::class]]; |
|
| 51 | 51 | }; |
| 52 | 52 | $permissions = $this |
| 53 | 53 | ->getMockBuilder(Permissions::class) |
@@ -69,46 +69,46 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | return [ |
| 72 | - [ 'educations', $defaultOptions], |
|
| 73 | - [ 'employments',$defaultOptions], |
|
| 74 | - [ 'skills', $defaultOptions], |
|
| 75 | - [ 'languageSkills', $defaultOptions], |
|
| 76 | - [ 'nativeLanguages', ['default' => [], 'value' => []]], |
|
| 77 | - [ 'preferredJob', [ 'default' => $prefJob, 'value' => $prefJob]], |
|
| 78 | - [ 'user', new User() ], |
|
| 79 | - [ 'contact', new Contact()], |
|
| 80 | - [ 'contact', ['value' => new Info(), 'expect' => '@' . Contact::class ]], |
|
| 72 | + ['educations', $defaultOptions], |
|
| 73 | + ['employments', $defaultOptions], |
|
| 74 | + ['skills', $defaultOptions], |
|
| 75 | + ['languageSkills', $defaultOptions], |
|
| 76 | + ['nativeLanguages', ['default' => [], 'value' => []]], |
|
| 77 | + ['preferredJob', ['default' => $prefJob, 'value' => $prefJob]], |
|
| 78 | + ['user', new User()], |
|
| 79 | + ['contact', new Contact()], |
|
| 80 | + ['contact', ['value' => new Info(), 'expect' => '@'.Contact::class]], |
|
| 81 | 81 | $indexedByOptions('languageSkills'), |
| 82 | 82 | $indexedByOptions('employments'), |
| 83 | 83 | $indexedByOptions('educations'), |
| 84 | 84 | $indexedByOptions('skills'), |
| 85 | - [ 'isDraft', [ 'value' => false, 'getter_method' => '*']], |
|
| 86 | - [ 'status', ['value' => new Status(), 'default' => new Status() ]], |
|
| 87 | - [ 'status', ['value' => Status::NONPUBLIC, 'expect' => '@' . Status::class]], |
|
| 88 | - [ 'status', ['value' => Status::PUBLIC_TO_ALL, 'ignore_getter' => true, |
|
| 89 | - 'pre' => function () use ($permissions2) { |
|
| 85 | + ['isDraft', ['value' => false, 'getter_method' => '*']], |
|
| 86 | + ['status', ['value' => new Status(), 'default' => new Status()]], |
|
| 87 | + ['status', ['value' => Status::NONPUBLIC, 'expect' => '@'.Status::class]], |
|
| 88 | + ['status', ['value' => Status::PUBLIC_TO_ALL, 'ignore_getter' => true, |
|
| 89 | + 'pre' => function() use ($permissions2) { |
|
| 90 | 90 | $this->target->setPermissions($permissions2); |
| 91 | 91 | }] |
| 92 | 92 | ], |
| 93 | - [ 'status', ['value' => Status::NONPUBLIC, 'ignore_getter' => true, |
|
| 94 | - 'pre' => function () use ($permissions2) { |
|
| 93 | + ['status', ['value' => Status::NONPUBLIC, 'ignore_getter' => true, |
|
| 94 | + 'pre' => function() use ($permissions2) { |
|
| 95 | 95 | $this->target->setPermissions($permissions2); |
| 96 | 96 | }, |
| 97 | - 'post' => function () use ($permissions2) { |
|
| 97 | + 'post' => function() use ($permissions2) { |
|
| 98 | 98 | $permissions2->__phpunit_verify(); |
| 99 | 99 | }] |
| 100 | 100 | ], |
| 101 | - [ 'attachments', $defaultOptions], |
|
| 102 | - [ 'user', ['value' => new User(), 'ignore_getter' => true, |
|
| 103 | - 'pre' => function () use ($permissions) { |
|
| 101 | + ['attachments', $defaultOptions], |
|
| 102 | + ['user', ['value' => new User(), 'ignore_getter' => true, |
|
| 103 | + 'pre' => function() use ($permissions) { |
|
| 104 | 104 | $this->target->setUser(new User())->setPermissions($permissions); |
| 105 | 105 | }, |
| 106 | - 'post' => function () use ($permissions) { |
|
| 106 | + 'post' => function() use ($permissions) { |
|
| 107 | 107 | $permissions->__phpunit_verify(); |
| 108 | 108 | } |
| 109 | 109 | ]], |
| 110 | 110 | |
| 111 | - [ 'resourceId', ['value' => 'Entity/Cv', 'ignore_setter' => true ]], |
|
| 111 | + ['resourceId', ['value' => 'Entity/Cv', 'ignore_setter' => true]], |
|
| 112 | 112 | ]; |
| 113 | 113 | } |
| 114 | 114 | } |