Commit graph

77 commits

Author SHA1 Message Date
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
Ceeram
eadc3a75e5 fix coding standards 2012-11-21 15:39:03 +01:00
mark_story
27d7e2865e Merge branch 'master' into 2.3
Conflicts:
	lib/Cake/Console/Command/ConsoleShell.php
	lib/Cake/Network/CakeSocket.php
	lib/Cake/Network/Http/HttpResponse.php
	lib/Cake/Utility/Folder.php
	lib/Cake/View/MediaView.php
	lib/Cake/basics.php
2012-11-20 23:02:33 -05:00
Ceeram
e02eab05d5 Remove all todo from core, create tickets for them 2012-11-14 14:59:51 +01:00
Reuben Helms
4d87abfcdc Add CakeTestCase::getMockForModel convenience method
This method provides a convenience to create mocked models that
are still associated with fixtures and the datasource.
2012-11-13 13:07:18 +10:00
Jose Lorenzo Rodriguez
bf0f5ab118 Merge remote-tracking branch 'origin/2.1' into 2.2 2012-04-29 20:05:39 -04:30
Kyle Robinson Young
b8488b8dfe Update 1.x @link in docblocks 2012-04-26 19:49:18 -07:00
Ceeram
74ee75b0ef Merge branch '2.1' into 2.2 2012-04-23 10:34:04 +02:00
Ceeram
f0bd7386e2 created, modified and updated fields now use static timestamp in testcases 2012-04-21 17:38:49 +02:00
mark_story
8639d5af84 Fix mistakes. 2012-04-15 22:54:13 -04:00
mark_story
72c3059d94 Add missing parent calls.
Fixes piles of failing tests.
2012-04-15 22:20:34 -04:00