Commit graph

136 commits

Author SHA1 Message Date
Val Bancer
c5d78b6302 Remove duplicate connect method from the unit test stub 2018-08-26 01:24:18 +02:00
Kazuki Higashiguchi
0e4a1d76ab test modified getMockForModelSecondaryDatasource 2018-03-10 12:59:10 +09:00
Koji Tanaka
400d45f56c fix code style 2017-12-31 17:05:26 +09:00
Koji Tanaka
74a8611eef [2.x]Fix can't load aliased component on ControllerTestCase 2017-12-31 15:44:05 +09: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
Marc Würth
17314baa15 Use HTTPS for the cakephp.org URL 2017-06-10 23:40:28 +02:00
ndm2
efb3474420 Fix query string data in URL arrays not being passed anymore.
refs #10555, #10517, #5473
2017-04-18 20:54:34 +02:00
ndm2
d9059b6d3b Fix array_intersect_key() argument order, the source comes first. 2017-04-15 21:27:29 +02:00
ndm2
7d74818d9a Fix ControllerTestCase::testAction() incompatibility with App.base.
When using array URLs with `testAction()`, the generated URL possibly
contains the configured `App.base` path, which needs to be stripped when
set on the request object, as otherwise routes cannot be matched
correctly.

When passing the URL as an option to the `CakeRequest` constructor, the
it will be set as-is, unlike when the URL is being generated by
`CakeRequest::_url()`, which grabs the URL from the environment, and
strips the possible base path.
2017-04-13 14:15:32 +02:00
mark_story
dc2fa498ef PHPCS. 2016-09-12 23:19:08 -04: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
f2638b3e38 Remove superfluous "Class" from doc blocks 2016-08-10 12:22:09 +02:00
Marc Würth
b5655d63ff Remove lighthouse references 2016-02-10 12:27:34 +01:00
Gareth Ellis
3f992695b2 Use traditional array syntax 2015-12-01 15:16:54 +00:00
Gareth Ellis
1bd22e5277 Add test for ConsoleOutputStub 2015-12-01 14:32:59 +00:00
Marc Würth
a6d62cb6a8 Removed $stringClean
Resfs: https://github.com/cakephp/cakephp/pull/7448#discussion_r40450663
2015-09-25 20:10:47 +02: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_story
096a2ebb72 Merge branch '2.6' into 2.7
Conflicts:
	lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
	lib/Cake/VERSION.txt
2015-04-20 15:42:54 -04:00
mark_story
5f2aa4c307 Fix errors when testing controllers that use file()
Fix errors related to ob_end_clean() closing PHPUnit's output buffer
when testing controller methods that use response->file().
2015-04-09 20:38:37 -04:00
mark_story
0b916cedbb Merge branch 'master' into 2.7 2015-03-09 21:55:20 -04: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
Mark Story
35e0dc2bbd Merge pull request #5760 from cakephp/master
Merge master into 2.7
2015-01-27 20:48:15 -05:00
Mark Scherer
76f7754014 Adding a status code test. 2015-01-26 10:29:52 +01:00
mark_story
4cd2c8fdcb Merge branch 'master' into 2.7 2015-01-03 14:34:55 -05:00
Esteban
58eb7b80ab Added All options enabled when running test from webfrontend
Fix failing test

Fix CS problem with new code

Fix test for code coverage generator

Fix tests

Fix CS Errors

Removed spaces in tabulation
2014-12-26 15:49:42 -03:00
euromark
53f1390b7d Backport array support for testAction() 2014-12-23 13:42:21 +01:00
mark_story
b55a88508f Fix PHPCS and PHP5.3 error. 2014-10-13 21:07:08 -04: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
euromark
974ca851c2 Correct doc blocks according to cs guidelines.
Remove superfluous empty lines.
2014-07-03 15:36:42 +02:00
ADmad
d466e00644 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Model/Datasource/DboSource.php
	lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
	lib/Cake/Utility/Folder.php
	lib/Cake/VERSION.txt
2014-05-04 14:35:36 +05:30
euromark
7a287a6942 More coding standard corrections. 2014-04-29 14:19:33 +02:00
Jose Lorenzo Rodriguez
343d3279b9 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Test/Case/Utility/FileTest.php
	lib/Cake/VERSION.txt
2014-04-06 21:50:41 +02:00
euromark
0d09a54033 more missing doc block tags added 2014-04-02 03:02:37 +02:00
mark_story
8acb75425d Merge branch 'master' into 2.5
Conflicts:
	CONTRIBUTING.md
	lib/Cake/Model/Datasource/DboSource.php
2014-03-21 22:55:28 -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
75dd2ff1fb Merge branch 'master' into 2.5 2014-01-16 15:20:40 -05:00
euromark
ecfd64c082 adding test 2014-01-06 21:07:00 +01:00
Stephen Young
8645e05ab1 Removed leading underscores from ReflectionProperty variables in test case 2013-12-07 12:10:03 -05:00
Stephen Young
f0036b3ebc CakeFixtureManager::load now calls CakeTestFixture::truncate 2013-12-07 09:47:06 -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
mark_story
53d265cfba Merge branch 'master' into 2.4 2013-08-23 12:56:43 -04:00
euromark
036954b52d remove duplicate newlines according to CS 2013-08-20 20:27:06 +02:00
AD7six
09cf69c452 Pass Controller:$components config to mocked components
Otherwise there can be significant differences in behavior between using
an unmodifiedcomponent in testAction and using a mock as the config will not be
propogated from the controller
2013-08-19 10:33:16 +00:00
José Lorenzo Rodríguez
a54c92fc0f Merge pull request #1475 from cakephp/feature/2.4-mock-app-model
Make mocking random models easier
2013-08-05 00:22:53 -07: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
35b4ac0286 make it possible to run this test on its own
Without setting up paths to the test_app - two of the tests will fail

Verify/demonstrate how to mock a model without a model existing
2013-08-03 16:00:04 +00:00
Marc Würth
1cac1846a3 Added missing calls to setUp & tearDown in tests 2013-07-29 01:52:39 +02:00
euromark
a643295e4c remove @access and unnecessary $name 2013-07-08 15:50:50 +02:00