Commit graph

87 commits

Author SHA1 Message Date
Koji Tanaka
a95654de88 clean: Stop overriding TestCase::run().
Overriding the run method to perform fixture management processing is no longer necessary since moved it to CakeFixtureInjector.

Co-authored-by: Kenshin Okinaka <okinakak@yahoo.co.jp>
2023-01-11 22:45:29 +01:00
Koji Tanaka
75716f76bc test: Add return type declarations to overridden methods of TestCase classes. 2023-01-11 22:45:29 +01:00
Markus Podar
459ee900fe
php-7.4-compact: replace deprecated curly brace offset access
Per https://wiki.php.net/rfc/deprecate_curly_braces_array_access and https://www.php.net/manual/en/migration74.deprecated.php
>  The array and string offset access syntax using curly braces is deprecated. Use $var[$idx] instead of $var{$idx}.
2020-03-20 21:10:58 +01:00
Val Bancer
e56452b2c5
Improve code style 2018-08-14 12:31:58 +02:00
Val Bancer
f5bf22e1e3
Do not unset $this->fixtures 2018-08-13 17:13:47 +02:00
Val Bancer
0e02af091a
Move unset to the proper place 2018-08-13 15:28:10 +02:00
Val Bancer
727aac1713
Move unset to the proper place 2018-08-13 15:06:19 +02:00
Val Bancer
cb23bf9223
Remove whitespace 2018-08-13 14:38:54 +02:00
Val Bancer
b45fe026f5
Unset more properties to free more memory 2018-08-13 14:20:29 +02:00
Val Bancer
dbbc8400b6
Free some memory in unit tests 2018-08-13 13:09:22 +02:00
Kazuki Higashiguchi
722a2b3286 In getMockForModel, place useDbConfig test_xxx 2018-03-10 10:51:30 +09:00
mark_story
7c2ad08da5 Clean up formatting.
Refs #10912
2017-08-03 13:17:05 -04:00
Val Bancer
5e92034ad8 improved code style 2017-07-18 22:31:28 +02:00
Val Bancer
7ba52d0c53 Fixed code style. 2017-07-16 00:27:20 +02:00
Val Bancer
93696b65e4 Fixed indefinite loop in getMock(). 2017-07-16 00:09:36 +02:00
Val Bancer
eefd3ac847 adapter for the getMock() depricated in phpunit 2017-07-15 23:23:14 +02:00
mark_story
2032fef772 Merge branch '2.x' into 2.next 2017-06-26 21:51:41 -04:00
Marc Würth
da8414e13b Use HTTPS for the opensource.org MIT license URL 2017-06-11 00:23:22 +02:00
Marc Würth
04efc7ba50 Use HTTPS for the book.cakephp.org URL 2017-06-11 00:15:36 +02:00
Marc Würth
10b89b51a9 Use HTTPS for the cakefoundation.org URL 2017-06-11 00:10:59 +02:00
Michael van Tricht
10052edb20 Make test suite compatible with PHPUnit 5. 2017-04-06 23:06:17 +02:00
chinpei215
3b75bd2dea Fix risky tests
- Fix CakeTestCase::run() to restore original output buffering level
- Fix an undefined variable warning in missing_controller.ctp
- Fix ViewTest (backport of 92bd86274b64c31ef6034caa74bb168be041b5e0)
- Fix ThemeViewTest
2017-03-25 20:24:31 +09:00
Mischa ter Smitten
dec7f54ecb Fixed typos 2016-11-11 21:43:43 +01:00
mark_story
9d1fbb95b3 Allow datasource access in constructors of mocked models.
When mock objects are created from models that access their datasource
in the constructor, an exception would be raised for the missing default
datasource. By changing how configuration data is handled in the mock
creation we can avoid this issue and not reopen #4867

Refs #8225
2016-09-12 22:15:55 -04:00
Marc Würth
1ede742d92 Various improvements to the CakePHP test files
Mostly CS, doc blocks and unused variables.
2015-09-25 17:22:00 +02:00
Mark Scherer
52e79987a2 Replacing self with static due to PHP5.3+. Following #7040. 2015-07-21 10:22:53 +02:00
KullTC
a7c2f26599 Make sure default datasource is not used for mock
When a non-default datasource is used for a model and no test_ version of
that datasource is available, the getMockForModel method used the
models standard datasource, rahter than 'test'.
2015-02-27 15:26:49 +01:00
antograssiot
c2f298a8b7 Replace our custom code fence with markdown standard fence 2015-01-09 13:47:25 +01:00
Gerd Katzenbeisser
bf3ff8e2ad Avoid connection to default for mocked models
Fixes #5565
2015-01-04 16:53:00 +01:00
mark_story
9b9e886df6 Fix getMockForModel() using the incorrect datasource.
Because getMockForModel() does not go through the test datasource
injection in ClassRegistry::init() we need to duplicate the basics of
that logic here. Thankfully, we already have a mock so we can do that
datasource switching without reflection. Of course this means there will
be limitations to how/when this will work, but I feel those scenarios
can probably be solved by not using mocks, or by mocking out the
problematic methods. This set of changes makes getMockForModel() work
with secondary datasources, as one would expect it to do, but I'm not
sure it ever did.

Refs #4694
2014-10-12 22:30:22 -04:00
Marc Würth
67ba9cb406 Update all @deprecated annotations
to adhere to the @deprecated <version> <description> format, where version and description are mandatory.
2014-09-02 17:03:22 +02:00
euromark
974ca851c2 Correct doc blocks according to cs guidelines.
Remove superfluous empty lines.
2014-07-03 15:36:42 +02:00
mark_story
d8b0083632 Fix api doc errors in TestSuite/ 2014-06-06 13:57:48 -04:00
mark_story
ab5da2a09f Fix the test suite package doc block errors. 2014-06-05 00:24:01 -04:00
mark_story
75fcc7c2f8 Don't use count() in a loop.
Use do while so the count does not happen in a loop statement. This
makes the code linter happier.
2014-03-23 11:00:59 -04:00
mark_story
a801be30d9 Use alternate quoting in assertTags()
When a preg pattern contains no `.` it probably doesn't need quote
anchors.
2014-03-21 22:53:25 -04:00
mark_story
af68f61e7a Make assertTags() run much faster.
Generating the various permutations a priori is incredibly expensive
with sets of attributes. Using nested loops that look for matches is
more efficient.

Add replacments for `.*` and `.+` in preg:/ prefixed attribute matchers
so they do not greedily eat all content. This also requires that preg:/
based attribute matchers *must* be quoted.

Fixes #3072
2014-03-21 22:52:52 -04:00
mark_story
a827b96804 Clean up doc blocks for assertTags. 2014-03-21 22:52:52 -04:00
mark_story
070b165527 Mark compatibility shims as deprecated.
Fixes #2845
2014-02-17 10:29:03 -05:00
Marc Würth
7cfa0116f4 Removed "PHP 5" from file header DocBlocks
This statement does not serve a purpose anymore.
In a long forgotten world it indicated the main version number of PHP which the code in the file was compatible to.
http://pear.php.net/manual/en/standards.sample.php
But since PHP 5.1 and later this is only marginally true.
Thus I propose to remove it from CakePHP.
2013-11-13 22:58:39 +01:00
AD7six
ff856b7ebb bark if the model doesn't exist
Getting the following warning:

    ReflectionException: Class Mock_Foo_e187b1d1 does not have a
constructor, so you cannot pass any constructor arguments

Is a much less obvious way of saying "the class you're trying to mock
doesn't exist". Be more explicit
2013-08-03 16:00:34 +00:00
AD7six
46b28aae50 merge config in getMockForModel
Otherwise, to override just one key, it's necessary to set all the other
defaults too
2013-08-03 16:00:04 +00:00
euromark
c989624f80 whitespace coding standards 2013-07-05 14:15:18 +02:00
Marc Würth
4c9f0414cb Improved the DocBlocks and other code cleanup
Fixed @license tag, url comes first
Whitespace and other minor code cleanup
Added some docblocks
2013-05-31 00:11:19 +02:00
mark_story
73310f9bfd Fix dropTables being ignore in some cases.
When autoFixtures = false & dropTables = false, individually loaded
fixtures should not be dropped.

Fixes #3691
2013-03-12 09:34:20 -04:00
euromark
111366d5c8 == to === and != to !== where applicable 2013-02-12 03:38:08 +01:00
Graham Weldon
66d856d883 Added extra line for referencing license file for copyright 2013-02-08 21:22:51 +09:00
Graham Weldon
7b860debe4 This commit is dedicated to Mark Story, who has put in much dedicated time and effort into CakePHP over the years.
I just wanted to ruin his evening, because this change needs to be merged into CakePHP 3.0.
2013-02-08 20:59:49 +09:00
Jose Lorenzo Rodriguez
f25f35353d Making getMockForModel actually useful 2012-12-23 00:30:27 +01:00
ADmad
72d6ca636f Docblock fixes 2012-11-29 04:36:29 +05:30