profile
viewpoint
Renan Gonçalves renan Werkspot.nl Amsterdam, The Netherlands

kvz/cakephp-rest-plugin 172

Discontinued: recent cakephp versions overlap functionality, there also is @ceeram's plugin. Painless REST server Plugin for CakePHP

kvz/system_daemon 146

Discontinued. All the boilerplate required to daemonize php

kvz/cakephp-elasticsearch-plugin 45

Discontinued. CakePHP plugin for Elasticsearch: the Open Source, Distributed, RESTful, Search Engine

renan/CakePHP-XHProf 21

Plugin that quickly enables XHProf profiling for your CakePHP application.

kvz/eventcache 17

Discontinued. PHP caching & invalidation for the lazy coder

fahad19/XMPPHP 3

XMPPHP is an elegant PHP library for XMPP (aka Jabber, Google Talk, Facebook etc).

kvz/cakephp-ipv6-plugin 3

Discontinued. Plugin-wrapped CakePHP behavior to work with IPv6 addresses with efficient MySQL storage

fahad19/run-scripts 2

Run multiple npm scripts sequentially in one go.

renan/cakephp 2

CakePHP: The Rapid Development Framework for PHP - Official Repository

issue closedcakephp/cakephp

Hash::mergeDiff not work as expected

This is a (multiple allowed):

  • [x] bug

  • [ ] enhancement

  • [ ] feature-discussion (RFC)

  • CakePHP Version: 3.x

What you did

EXPLAIN WHAT YOU DID, PREFERABLY WITH CODE EXAMPLES, HERE. $res = Hash::mergeDiff(['a'=>'aa'], ['a'=>['bb'=>'bbb']]);

What happened

EXPLAIN WHAT IS ACTUALLY HAPPENING, HERE. error pops TypeError: Argument 1 passed to Cake\Utility\Hash::mergeDiff() must be of the type array, string given

What you expected to happen

EXPLAIN WHAT IS TO BE EXPECTED, HERE. I expected $res to remain the same as the first argument Array ( [a] => aa )

closed time in 3 hours

lazur5566

PR opened cakephp/cakephp

3.x - Fix Hash::mergeDiff() not handling scalar values.

Fixes #15190

+16 -2

0 comment

2 changed files

pr created time in 3 hours

create barnchcakephp/cakephp

branch : fix-15190-3x

created branch time in 3 hours

PR opened cakephp/cakephp

Fix Hash::mergeDiff() not handling scalar values.

Fixes #15190

+16 -2

0 comment

2 changed files

pr created time in 3 hours

create barnchcakephp/cakephp

branch : fix-15190

created branch time in 3 hours

push eventcakephp/cakephp

Mark Story

commit sha 765a5a6927f600cf2ae99b9ad8bd4f801f5fe1d7

Improve tests for mockService()

view details

push time in 3 hours

pull request commentcakephp/app

Update .gitignore

No.

Windows XP Media Center Edition creates ehthumbs.db which holds previews of video files wikipedia. It is old OS, I don't know if any newer OS still uses it.

markusramsak

comment created time in 7 hours

PR opened cakephp/app

Update .gitignore

typo?!

<!---

PLEASE NOTE:

This is only a issue tracker for issues related to the CakePHP Application Skeleton. For CakePHP Framework issues please use this issue tracker.

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.

The best way to propose a feature is to open an issue first and discuss your ideas there before implementing them.

Always follow the contribution guidelines guidelines when submitting a pull request. In particular, make sure existing tests still pass, and add tests for all new behavior. When fixing a bug, you may want to add a test to verify the fix.

-->

+1 -1

0 comment

1 changed file

pr created time in 7 hours

push eventcakephp/cakephp

Corey Taylor

commit sha 611c9ee7c194d4ec21f865ad74a4c4a4b52e81d0

Added Query::subquery() which disables field aliasing

view details

Corey Taylor

commit sha 0387ecfe93dc5ecba7872074f8f1a10b850fe8a7

Changed subquery() to return static

view details

Corey Taylor

commit sha 0c230caa76f19ac650aecc503a39b14ad72c48b9

Merge branch '4.next' into query-subquery

view details

Mark Story

commit sha 2c2d867842b55a58728c7be25517c510bc36e9c7

Bump version for 4.next

view details

Corey Taylor

commit sha 60cd4aef58c9b55345b5263ab9ce5596730f1e84

Merge branch 'master' into 4.next

view details

Corey Taylor

commit sha 2dd79baf18328a8246ebc53845a720ef4189c91a

Merge branch '4.next' into query-subquery

view details

Corey Taylor

commit sha 1e8a9968b116b2ba2420ee0fb05cf6a1524befc8

Changed subquery() to static function and use connection from Table

view details

Corey Taylor

commit sha a881dcec87589198e0c351814ceb7409e0d16dd8

Add test for using subquery() for WHERE IN (SELECT ...)

view details

Mark Story

commit sha 941d99809fb4886c691a725f118d786c46583162

Merge pull request #14764 from cakephp/query-subquery Added Query::subquery() which disables field aliasing

view details

Corey Taylor

commit sha 9f85c81428f80483e8a074df4f0cb704f0055a0f

Add unit test for using subquery() in join clause

view details

Corey Taylor

commit sha 8d1c8ba55b9f5addf894fc4e17b0d0220639c9f1

Use lower case alias in join

view details

Corey Taylor

commit sha bea0655dc2f0287a25bc9980c8709b15d533af8f

Use IdentifierExpression for join on clause

view details

Mark Story

commit sha 542a1ab37d50d09cebbf778e4730779c40e89f86

Merge pull request #14808 from cakephp/join-subquery Add unit test for using subquery() in join clause

view details

Mark Story

commit sha 252be87a1a89491495cc49e2b12279bc1c2c3789

Add session based CSRF token middleware The current double submit cookie CSRF middleware has a few potential weaknesses: 1. The tokens it uses are portable between users. If a user has their browser compromised, CSRF tokens can be re-used between other compromised users. 2. Tokens don't have an expiration time. If a CSRF token is leaked and a user is compromised an old token can be used again. These changes introduce an alternative CSRF middleware that stores the compare token in the session. This removes the need to do HMAC signing as the compare value is in the session where an attacker cannot change it. Furthermore, it also couples CSRF tokens to the user, and to the specific session. This mitigates both weaknesses with our existing CSRF middleware. I didn't want to make the existing CSRF middleware more complicated and risk breaking backwards compatibility which is why this is a new middleware. A separate middleware makes opt-ing into session based tokens explicit.

view details

ADmad

commit sha 101d4caffbd9b733a7898ad8b43f0a921de2c99c

Merge branch 'master' into 4.next

view details

Mark Story

commit sha c14e49b3054be164295ff0e5b2394c3fe5b3dd1c

Update src/Http/Middleware/SessionCsrfProtectionMiddleware.php Co-authored-by: othercorey <corey.taylor.fl@gmail.com>

view details

ADmad

commit sha ba06069e6884d21ca99c04ea6b343b1eb5257139

Fix CS error

view details

ADmad

commit sha a120ac6e0d83896b47e624986a9e0d0e8d96e6c6

Fix "@since" tag

view details

Corey Taylor

commit sha 40f72046b55d9a95739acaf441b159573a06a3c1

Add Table::subquery() wrapper

view details

Corey Taylor

commit sha 3629b5e8aa1e395c61a2bfdd1960792795f829b3

Merge branch 'master' into 4.next

view details

push time in 7 hours

push eventcakephp/cakephp

mscherer

commit sha 029798ec544805e0151e8119e2b7ddb18078ea28

Fix up event docs.

view details

Mark Story

commit sha 71ad4abbb8a5d59da0cbf9df5dd5b57ac42fd3d5

Merge pull request #15144 from cakephp/docs Fix up event docs.

view details

Mark Story

commit sha 1db878fee90b0023e0d36967c4cbda3a4062d56d

Use memcache docker image instead of apt package.

view details

Mark Story

commit sha 6a0f6e99463c657dfc1ccd3c41c902784edbc292

Merge pull request #15146 from cakephp/memcache-service Use memcache docker image instead of apt package.

view details

mscherer

commit sha f17ebfc7372d556f5e96970f2c1d138964df8a57

Add test for retaining and flash messages.

view details

saeideng

commit sha a64caa3f63676512c52255a62d6451f8445ccd52

add missing method to solve the error ```Fatal error: Class Application contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Psr\Http\Server\RequestHandlerInterface::handle)```

view details

Mark Story

commit sha 2218585c240fad1e225a7af2b6335a7bbcfe8880

Merge pull request #15150 from cakephp/add-flash-redirect-test Add test for retaining and flash messages.

view details

Mark Story

commit sha 168ef6024eecba48ec354e173adc751cfb08fa9d

Merge pull request #15153 from cakephp/saeideng-patch-1 add missing method - documentation

view details

Ikko Ashimine

commit sha 8640c80dc92d57caf1ab3b4d6d87e6ef749893b5

Fix typo in comment doesnt -> doesn't

view details

Mark Sch

commit sha 9247aac6017886bb51e127e21eff157a0377ee61

Merge pull request #15156 from eltociear/patch-1 Fix typo in comment

view details

ndm2

commit sha cee259915222c7f8e874b9f52d9c543f37a63da3

Fix SQL Server missing parentheses on paging subquery in order clause.

view details

Mark Story

commit sha 344579dcfdc31ddec881308ac57e8b36c87e35dd

Merge pull request #15164 from ndm2/4.x-fix-sql-server-subquery-select-order 4.x - Fix SQL Server missing parentheses on paging subquery in order clause.

view details

ndm2

commit sha 7d7a17c86f6cd0fba14c908fcdf7d94a3d6a828d

Fix missing parentheses when ordering by query expression.

view details

ndm2

commit sha a69cad2f665277325e3af732114b0e102f044a17

Fix SQL Server bindings conflict when ordering by expression fields.

view details

ndm2

commit sha d7f0390db1ed53909069d093372c971f992f5fdc

Fix CS.

view details

ndm2

commit sha eccaa7846b1ab435b3bbc480bffd0b5da2a5142f

Fix limit/offset SQL comparison failing on SQL Server.

view details

ndm2

commit sha 1219336eff6b9cce78337c8d20e979b93c44126f

Fix CS.

view details

ndm2

commit sha 634db9a273f365e9e60daaa087ece98326e4d3a1

Fix test failing on Postgres because NULLS FIRST behavior.

view details

ndm2

commit sha fabfe84db93f280f26b7031d0754dd9b0f42297a

Fix cannot reuse placeholders with SQL Server.

view details

mscherer

commit sha d16e720a2421c7534ddd9bc2240a6a1d371d1203

Add better exception output

view details

push time in 7 hours

push eventcakephp/cakephp

Corey Taylor

commit sha 49250eb989b1886eb049a00e8809b9e8107c22a1

Enable cli opcache for all builds and jit for php 8

view details

push time in 8 hours

PR opened cakephp/cakephp

Enable cli opcache
+2 -2

0 comment

1 changed file

pr created time in 8 hours

create barnchcakephp/cakephp

branch : php8-jit

created branch time in 8 hours

push eventcakephp/phinx

Matthew Peveler

commit sha f37b800022127a6a7361b453aa5c8715c6a23e8f

Remove Travis and appveyor badges from README Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>

view details

Matthew Peveler

commit sha a83df731dff3f8e30b96099fef260e91c8dab7b9

Merge branch 'master' into patch-18

view details

Mark Sch

commit sha a5d257ff32dabbef851b6a9c74a59be99a49b04e

Merge pull request #1933 from MasterOdin/patch-18 Remove Travis and appveyor badges from README

view details

push time in 9 hours

Pull request review commentcakephp/cakephp

4.next - Add test case methods for mocking services

+<?php+declare(strict_types=1);++/**+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)+ * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)+ *+ * Licensed under The MIT License+ * For full copyright and license information, please see the LICENSE.txt+ * Redistributions of files must retain the above copyright notice+ *+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)+ * @since         4.2.0+ * @license       http://www.opensource.org/licenses/mit-license.php MIT License+ */+namespace Cake\TestSuite;++use Cake\Core\Configure;+use Cake\Core\ContainerInterface;+use Cake\Event\EventInterface;+use Closure;+use LogicException;++/**+ * A set of methods used for defining container services+ * in test cases.+ *+ * This trait leverages the `Application.buildContainer` event+ * to inject the mocked services into the container that the+ * application uses.+ */+trait ContainerStubTrait+{+    /**+     * The customized application class name.+     *+     * @psalm-var class-string<\Cake\Core\HttpApplicationInterface>|class-string<\Cake\Core\ConsoleApplicationInterface>|null+     * @var string|null+     */+    protected $_appClass;++    /**+     * The customized application constructor arguments.+     *+     * @var array|null+     */+    protected $_appArgs;++    /**+     * The collection of container services.+     *+     * @var array+     */+    private $containerServices = [];++    /**+     * Configure the application class to use in integration tests.+     *+     * @param string $class The application class name.+     * @param array|null $constructorArgs The constructor arguments for your application class.+     * @return void+     * @psalm-param class-string<\Cake\Core\HttpApplicationInterface>|class-string<\Cake\Core\ConsoleApplicationInterface> $class+     */+    public function configApplication(string $class, ?array $constructorArgs): void+    {+        $this->_appClass = $class;+        $this->_appArgs = $constructorArgs;+    }++    /**+     * Create an application instance.+     *+     * Uses the configuration set in `configApplication()`.+     *+     * @return \Cake\Core\HttpApplicationInterface|\Cake\Core\ConsoleApplicationInterface+     */+    protected function createApp()+    {+        if ($this->_appClass) {+            $appClass = $this->_appClass;+        } else {+            /** @psalm-var class-string<\Cake\Http\BaseApplication> */+            $appClass = Configure::read('App.namespace') . '\Application';+        }+        if (!class_exists($appClass)) {+            throw new LogicException("Cannot load `{$appClass}` for use in integration testing.");+        }+        $appArgs = $this->_appArgs ?: [CONFIG];++        $app = new $appClass(...$appArgs);+        if (!empty($this->containerServices) && method_exists($app, 'getEventManager')) {+            $app->getEventManager()->on('Application.buildContainer', [$this, 'modifyContainer']);+        }+        return $app;+    }++    /**+     * Add a mocked service to the container.+     *+     * When the container is created the provided classname+     * will be mapped to the factory function. The factory+     * function will be used to create mocked services.+     *+     * @param string $class The class or interface you want to define.+     * @param \Closure $factory The factory function for mocked services.+     * @return $this+     */+    public function mockService(string $class, Closure $factory)+    {+        $this->containerServices[$class] = $factory;++        return $this;+    }++    /**+     * Remove a mocked service to the container.+     *+     * @param string $class The class or interface you want to remove.+     * @return $this+     */+    public function removeMockService(string $class)+    {+        unset($this->containerServices[$class]);++        return $this;+    }++    /**+     * Wrap the application's container with one containing mocks.+     *+     * If any mocked services are defined, the application's container+     * will be replaced with one containing mocks. The original+     * container will be set as a delegate to the mock container.+     *+     * @param \Cake\Event\EventInterface $event The event+     * @param \Cake\Core\ContainerInterface $container The container to wrap.+     * @return null|\Cake\Core\ContainerInterface+     */+    public function modifyContainer(EventInterface $event, ContainerInterface $container): ?ContainerInterface+    {+        if (empty($this->containerServices)) {+            return null;+        }+        foreach ($this->containerServices as $key => $factory) {+            if ($container->has($key)) {+                $container->extend($key)->setConcrete($factory);

oh, ok, so you're just exposing a League/Container function to the Cake interface that extends the PSR interface.

markstory

comment created time in 11 hours

push eventcakephp/cakephp

Mark Story

commit sha ca5422ffa71321f2414b7236a6dae224197a3548

More PHPCS fixes.

view details

push time in 11 hours

push eventcakephp/cakephp

Mark Story

commit sha f8a5fed5f1280b74b12b02df7e5753242d461269

Fix phpcs warnings

view details

push time in 11 hours

push eventcakephp/cakephp

Mark Story

commit sha b30540eea0a0d27febd3d302b44041b0716a808e

Bump league/container to the version that provides setConcrete()

view details

push time in 11 hours

Pull request review commentcakephp/cakephp

4.next - Add test case methods for mocking services

+<?php+declare(strict_types=1);++/**+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)+ * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)+ *+ * Licensed under The MIT License+ * For full copyright and license information, please see the LICENSE.txt+ * Redistributions of files must retain the above copyright notice+ *+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)+ * @since         4.2.0+ * @license       http://www.opensource.org/licenses/mit-license.php MIT License+ */+namespace Cake\TestSuite;++use Cake\Core\Configure;+use Cake\Core\ContainerInterface;+use Cake\Event\EventInterface;+use Closure;+use LogicException;++/**+ * A set of methods used for defining container services+ * in test cases.+ *+ * This trait leverages the `Application.buildContainer` event+ * to inject the mocked services into the container that the+ * application uses.+ */+trait ContainerStubTrait+{+    /**+     * The customized application class name.+     *+     * @psalm-var class-string<\Cake\Core\HttpApplicationInterface>|class-string<\Cake\Core\ConsoleApplicationInterface>|null+     * @var string|null+     */+    protected $_appClass;++    /**+     * The customized application constructor arguments.+     *+     * @var array|null+     */+    protected $_appArgs;++    /**+     * The collection of container services.+     *+     * @var array+     */+    private $containerServices = [];++    /**+     * Configure the application class to use in integration tests.+     *+     * @param string $class The application class name.+     * @param array|null $constructorArgs The constructor arguments for your application class.+     * @return void+     * @psalm-param class-string<\Cake\Core\HttpApplicationInterface>|class-string<\Cake\Core\ConsoleApplicationInterface> $class+     */+    public function configApplication(string $class, ?array $constructorArgs): void+    {+        $this->_appClass = $class;+        $this->_appArgs = $constructorArgs;+    }++    /**+     * Create an application instance.+     *+     * Uses the configuration set in `configApplication()`.+     *+     * @return \Cake\Core\HttpApplicationInterface|\Cake\Core\ConsoleApplicationInterface+     */+    protected function createApp()+    {+        if ($this->_appClass) {+            $appClass = $this->_appClass;+        } else {+            /** @psalm-var class-string<\Cake\Http\BaseApplication> */+            $appClass = Configure::read('App.namespace') . '\Application';+        }+        if (!class_exists($appClass)) {+            throw new LogicException("Cannot load `{$appClass}` for use in integration testing.");+        }+        $appArgs = $this->_appArgs ?: [CONFIG];++        $app = new $appClass(...$appArgs);+        if (!empty($this->containerServices) && method_exists($app, 'getEventManager')) {+            $app->getEventManager()->on('Application.buildContainer', [$this, 'modifyContainer']);+        }+        return $app;+    }++    /**+     * Add a mocked service to the container.+     *+     * When the container is created the provided classname+     * will be mapped to the factory function. The factory+     * function will be used to create mocked services.+     *+     * @param string $class The class or interface you want to define.+     * @param \Closure $factory The factory function for mocked services.+     * @return $this+     */+    public function mockService(string $class, Closure $factory)+    {+        $this->containerServices[$class] = $factory;++        return $this;+    }++    /**+     * Remove a mocked service to the container.+     *+     * @param string $class The class or interface you want to remove.+     * @return $this+     */+    public function removeMockService(string $class)+    {+        unset($this->containerServices[$class]);++        return $this;+    }++    /**+     * Wrap the application's container with one containing mocks.+     *+     * If any mocked services are defined, the application's container+     * will be replaced with one containing mocks. The original+     * container will be set as a delegate to the mock container.+     *+     * @param \Cake\Event\EventInterface $event The event+     * @param \Cake\Core\ContainerInterface $container The container to wrap.+     * @return null|\Cake\Core\ContainerInterface+     */+    public function modifyContainer(EventInterface $event, ContainerInterface $container): ?ContainerInterface+    {+        if (empty($this->containerServices)) {+            return null;+        }+        foreach ($this->containerServices as $key => $factory) {+            if ($container->has($key)) {+                $container->extend($key)->setConcrete($factory);

Yeah it is in League/Container

markstory

comment created time in 12 hours

push eventcakephp/cakephp

Mark Story

commit sha f89e1459176ca9b9cf852e6fd20a4ef294a8c17d

Fix lint error.

view details

push time in 12 hours

Pull request review commentcakephp/cakephp

Fix incorrect URL generation

 public function testQueryStringAndNamedParams() { 		$request = new CakeRequest(); 		$this->assertEquals('some/path', $request->url); -		$_SERVER['REQUEST_URI'] = Configure::read('App.fullBaseUrl') . '/other/path?url=https://cakephp.org';+		$base = Configure::read('App.fullBaseUrl');+		$_SERVER['REQUEST_URI'] = $base . '/other/path?url=https://cakephp.org'; 		$request = new CakeRequest(); 		$this->assertEquals('other/path', $request->url);++		$_SERVER['REQUEST_URI'] =  str_repeat('x', strlen($base) - 4) . '://?/other/path';+		$request = new CakeRequest();+		$this->assertEquals('', $request->url);

Not entirely sure, but I was aiming to make the minimum amount of changes to resolve the problem.

markstory

comment created time in 12 hours

created tagcakephp/debug_kit

tag4.3.9

Debug Toolbar for CakePHP applications.

created time in 12 hours

release cakephp/debug_kit

4.3.9

released time in 12 hours

push eventcakephp/debug_kit

Mark Story

commit sha 7a263e51e6883717b50a9f953c3f1b978913134e

Preserve cache configuration better. Don't overwrite the entire cache configuration data. This allows `Cache::getConfig()` to continue working as it normally should. Fixes #801

view details

Mark Story

commit sha ca09b72339ec52ff15c1b10338106fa674e3c079

Merge pull request #802 from cakephp/fix-801 Preserve cache configuration better.

view details

push time in 12 hours

delete branch cakephp/debug_kit

delete branch : fix-801

delete time in 12 hours

PR merged cakephp/debug_kit

Preserve cache configuration better.

Don't overwrite the entire cache configuration data. This allows Cache::getConfig() to continue working as it normally should.

Fixes #801

+10 -2

1 comment

2 changed files

markstory

pr closed time in 12 hours

Pull request review commentcakephp/cakephp

4.next - Add test case methods for mocking services

 protected function buildContainer(): ContainerInterface             $plugin->services($container);         } +        $event = $this->dispatchEvent('Application.buildContainer', ['container' => $container]);

We should start adding constants for the event names. Today itself I had made a typo in an event name and has to waste a few precious seconds to realize my mistake and fix it :slightly_smiling_face:.

markstory

comment created time in 15 hours

Pull request review commentcakephp/cakephp

4.next - Add test case methods for mocking services

+<?php+declare(strict_types=1);++/**+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)+ * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)+ *+ * Licensed under The MIT License+ * For full copyright and license information, please see the LICENSE.txt+ * Redistributions of files must retain the above copyright notice+ *+ * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)+ * @since         4.2.0+ * @license       http://www.opensource.org/licenses/mit-license.php MIT License+ */+namespace Cake\TestSuite;++use Cake\Core\Configure;+use Cake\Core\ContainerInterface;+use Cake\Event\EventInterface;+use Closure;+use LogicException;++/**+ * A set of methods used for defining container services+ * in test cases.+ *+ * This trait leverages the `Application.buildContainer` event+ * to inject the mocked services into the container that the+ * application uses.+ */+trait ContainerStubTrait+{+    /**+     * The customized application class name.+     *+     * @psalm-var class-string<\Cake\Core\HttpApplicationInterface>|class-string<\Cake\Core\ConsoleApplicationInterface>|null+     * @var string|null+     */+    protected $_appClass;++    /**+     * The customized application constructor arguments.+     *+     * @var array|null+     */+    protected $_appArgs;++    /**+     * The collection of container services.+     *+     * @var array+     */+    private $containerServices = [];++    /**+     * Configure the application class to use in integration tests.+     *+     * @param string $class The application class name.+     * @param array|null $constructorArgs The constructor arguments for your application class.+     * @return void+     * @psalm-param class-string<\Cake\Core\HttpApplicationInterface>|class-string<\Cake\Core\ConsoleApplicationInterface> $class+     */+    public function configApplication(string $class, ?array $constructorArgs): void+    {+        $this->_appClass = $class;+        $this->_appArgs = $constructorArgs;+    }++    /**+     * Create an application instance.+     *+     * Uses the configuration set in `configApplication()`.+     *+     * @return \Cake\Core\HttpApplicationInterface|\Cake\Core\ConsoleApplicationInterface+     */+    protected function createApp()+    {+        if ($this->_appClass) {+            $appClass = $this->_appClass;+        } else {+            /** @psalm-var class-string<\Cake\Http\BaseApplication> */+            $appClass = Configure::read('App.namespace') . '\Application';+        }+        if (!class_exists($appClass)) {+            throw new LogicException("Cannot load `{$appClass}` for use in integration testing.");+        }+        $appArgs = $this->_appArgs ?: [CONFIG];++        $app = new $appClass(...$appArgs);+        if (!empty($this->containerServices) && method_exists($app, 'getEventManager')) {+            $app->getEventManager()->on('Application.buildContainer', [$this, 'modifyContainer']);+        }+        return $app;+    }++    /**+     * Add a mocked service to the container.+     *+     * When the container is created the provided classname+     * will be mapped to the factory function. The factory+     * function will be used to create mocked services.+     *+     * @param string $class The class or interface you want to define.+     * @param \Closure $factory The factory function for mocked services.+     * @return $this+     */+    public function mockService(string $class, Closure $factory)+    {+        $this->containerServices[$class] = $factory;++        return $this;+    }++    /**+     * Remove a mocked service to the container.+     *+     * @param string $class The class or interface you want to remove.+     * @return $this+     */+    public function removeMockService(string $class)+    {+        unset($this->containerServices[$class]);++        return $this;+    }++    /**+     * Wrap the application's container with one containing mocks.+     *+     * If any mocked services are defined, the application's container+     * will be replaced with one containing mocks. The original+     * container will be set as a delegate to the mock container.+     *+     * @param \Cake\Event\EventInterface $event The event+     * @param \Cake\Core\ContainerInterface $container The container to wrap.+     * @return null|\Cake\Core\ContainerInterface+     */+    public function modifyContainer(EventInterface $event, ContainerInterface $container): ?ContainerInterface+    {+        if (empty($this->containerServices)) {+            return null;+        }+        foreach ($this->containerServices as $key => $factory) {+            if ($container->has($key)) {+                $container->extend($key)->setConcrete($factory);

Does anything implement extend? I don't see it anywhere.

markstory

comment created time in 15 hours

Pull request review commentcakephp/cakephp

4.next - Add test case methods for mocking services

 public function add(string $id, $concrete = null, bool $shared = false): Definit      * @return $this      */     public function addServiceProvider($provider);++    /**+     * Modify an existing definition+     *+     * @param string $id The class name or name of the service being modified.+     * @return \League\Container\Definition\DefinitionInterface+     */+    public function extend(string $id): DefinitionInterface;

Nevermind. i see the psr interface uses id.

markstory

comment created time in 15 hours

more