Commit graph

409 commits

Author SHA1 Message Date
mark_story
c6db76d044 Instead of wiping the Router, just clear requests.
Clearing the router also removes routes which can cause assertions to
fail. By just removing the stored requests we avoid the error reported
in #8480 and not break as many tests.
2016-03-20 11:10:34 -04:00
mark_story
7ceb0993bf Clear the router state after testAction().
When using array urls, internal state in the Router would cause requests
to be incorrectly handled causing multiple testAction calls in a single
test to fail. By reloading the router we start off with a clean slate
each time.

Refs #8480
2016-03-19 12:16:21 -04:00
Gareth Ellis
af487e7f89 Fix spacing 2016-01-05 16:39:07 +00:00
Gareth Ellis
54b4170022 Add doc block for testAction magic method to enable IDE autocompletion in test classes 2016-01-05 11:57:40 +00:00
Gareth Ellis
3f992695b2 Use traditional array syntax 2015-12-01 15:16:54 +00:00
Gareth Ellis
eafee25d13 PHPCS fixes 2015-12-01 14:26:22 +00:00
Gareth Ellis
788c57dd4b Add progress helper 2015-12-01 12:03:09 +00:00
mark_story
17c3358d77 Revert part of the changes in 1ede742d92
These variables are used by the HTML test reporter.
2015-09-29 21:41:33 -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
mark_story
d7d8b90986 Merge branch '2.6' into 2.7 2015-05-28 19:34:59 -04:00
mark_story
6cb21e6dc8 Change default value to allow code coverage on non-app files.
Don't default to app, as it prevents generating code coverage for core
and plugin files.

Fixes #6533
2015-05-10 21:34:08 -04: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
eb85a875c0 Merge branch 'master' into 2.7 2015-02-10 23:00:43 -05:00
David Yell
703be31c83 Update phpunit.php
PHPUnit can no longer be installed using pear
2015-02-05 12:02:18 +00:00
mark_story
ac9a212d44 Merge branch 'master' into 2.7
Conflicts:
	lib/Cake/Utility/String.php
2015-01-11 15:25:18 -05: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
4cd2c8fdcb Merge branch 'master' into 2.7 2015-01-03 14:34:55 -05:00
Esteban
fe3d2b938c Added conditional to do not show rerun link if is warning of no test present
CS Fix

Update CakeHtmlReporter.php

Removed spaces in array return
2014-12-26 15:50:25 -03:00
Esteban
21f3a51ebc Rerun only one test option adding
Changed scope of function and fix CS problem
2014-12-26 15:50:23 -03: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
Esteban
b7510d4883 Avoids problem with code coverage switch when are to equaly named files in a test 2014-12-23 17:23:12 -03:00
euromark
22a4a2f5de Correct argument. Should not have a default string. 2014-12-23 15:36:25 +01:00
euromark
d089341ee7 Wording. 2014-12-23 13:46:55 +01:00
euromark
53f1390b7d Backport array support for testAction() 2014-12-23 13:42:21 +01:00
Marc Würth
e778b5dce2 Corrected/Improved DocBlock 2014-12-19 18:20:48 +01:00
mark_story
23c4b7b7d5 Fix whitespace. 2014-12-10 22:17:02 -05:00
Mark Story
2228afda0e Merge pull request #5334 from tranfuga25s/master
Change output to show the difference between fixture data and fields
2014-12-10 22:16:33 -05:00
tranfuga25s
360346acd0 Added PHPCS fixes 2014-12-09 09:35:12 -03:00
tranfuga25s
674af51d6b Added PHPCS fixes 2014-12-09 09:16:34 -03:00
tranfuga25s
9ecdaf7965 Added PHPCS fixes and better array diff handling on fixture data count difference 2014-12-09 08:56:34 -03:00
euromark
e1c128bb99 Consolidate with conditions sniff. 2014-12-09 03:17:35 +01:00
tranfuga25s
b0d0143b82 Fix PHPCS problems 2014-12-05 16:14:47 -03:00
tranfuga25s
ec2530ba58 Fix PHPCS problems and a better comparation of schema and data 2014-12-05 16:01:49 -03:00
tranfuga25s
fc756ac0b8 fix some small typo changing variables names 2014-12-05 15:34:53 -03:00
tranfuga25s
a2d04589a6 Change to output the difference between fixture data and fields 2014-12-05 15:23:48 -03:00
Guy Warner
327fcb4846 Fix some missed doc block issues 2014-11-30 14:50:11 -07:00
Guy Warner
fb61d9393b Add @trigger doc blocks of methods triggering CakeEvent 2014-11-30 14:45:40 -07:00
Lawrence Barsanti
9631b54244 remove space 2014-11-24 16:36:43 -05:00
Lawrence Barsanti
bb5088cda3 PHPUnit can be included as a phar file.
No need to install phpunit in order to run unit tests.  Simply place
'phpunit.phar' in the vendors folder.
2014-11-24 14:51:36 -05: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
Carl Sutton
8d58d93636 Make the error message better for fixture errors
The stack trace has no details about which fixture is the actual problem.
2014-07-15 13:21:48 +01:00
euromark
974ca851c2 Correct doc blocks according to cs guidelines.
Remove superfluous empty lines.
2014-07-03 15:36:42 +02:00
Mark
1686edf016 Revert "No truncate when drop table." 2014-06-30 14:14:20 +02:00
mark_story
91721244a4 Fix more doc block errors in lib/ 2014-06-27 22:58:34 -04:00
euromark
26fe1265ab Mark App::pluginPath as deprecated and don't use it anymore. 2014-06-24 11:52:29 +02:00
Mark Story
c99c68684b Merge pull request #3646 from nanapi/no-truncate-fixture
Don't truncate test fixtures when the table has been freshly created.
2014-06-18 09:18:24 -04:00
mark_story
d8b0083632 Fix api doc errors in TestSuite/ 2014-06-06 13:57:48 -04:00
akiyan
6d2402fbf6 No truncate when drop table. 2014-06-05 13:37:22 +09:00
mark_story
ab5da2a09f Fix the test suite package doc block errors. 2014-06-05 00:24:01 -04:00
David Yell
140e0bbbd3 Updated the test suite dispatcher to allow use of PHPUnit from Composer
Closes #3479
2014-05-14 09:09:53 +07:00
euromark
4f3578ebda Fix CakeHtmlReporter output for HTML 2014-04-12 13:37:36 +02:00
euromark
0ece694a75 microptimize options and default merge and other string key array merges 2014-04-08 01:25:14 +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
bbe3b6a439 more cs 2014-04-02 03:09:42 +02:00
mark_story
d713ff2c6a Correct docblock.
Refs #3147
2014-03-29 20:19:34 -04:00
Harold Putman
522b5048f8 Expose canUseMemory
This lets Fixture be used to create an actual persistent table with InnoDB engine instead of MEMORY.
2014-03-28 09:24:49 -04:00
mark_story
57b8008dbe Merge branch 'master' into 2.5 2014-03-23 11:01:13 -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
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
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
euromark
97c148a170 Correct typo 2014-03-19 12:47:31 +01:00
Tounu
482b90e6b1 Php cs fixed 2014-03-11 21:16:30 +01:00
Tounu
e4c47f87dd Creation of a method to parse fixture path
Creation of `_parseFixturePath`
2014-03-11 20:55:46 +01:00
Tounu
316fd50443 Allow sub-directories for Fixture folder
Allow sub-directories for Test/Fixture folder (for app. and plugin.)
The directory separator is '/'.
A file ``MyClassFixture.php` in the folder `Fixture/MyFolder` will be included like this :
`'app.MyFolder/my_class'`
2014-03-11 20:12:52 +01:00
mark_story
a965903777 Merge branch 'master' into 2.5 2014-02-17 10:51:32 -05:00
mark_story
070b165527 Mark compatibility shims as deprecated.
Fixes #2845
2014-02-17 10:29:03 -05:00
mark_story
2c5d96e916 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Model/Datasource/DboSource.php
2014-02-16 14:24:19 -05:00
mark_story
a5d50da040 Remove dead and unused code. 2014-02-11 16:38:24 -05: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
euromark
865ca7acd6 wording 2014-01-06 20:43:30 +01:00
euromark
1201887ad1 Clearer error message 2014-01-06 20:42:17 +01:00
Stephen Young
f0036b3ebc CakeFixtureManager::load now calls CakeTestFixture::truncate 2013-12-07 09:47:06 -05:00
ADmad
dda6080579 Merge branch 'master' into 2.5 2013-11-19 00:27:12 +05:30
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
Kim Egede Jakobsen
18e0dc95dd Remove @return from docblock (for __construct && __destruct methods) 2013-11-11 14:54:48 +01:00
Kim Egede Jakobsen
f0205f53ad Try to make same comments for constructors.
Conflicts:
	lib/Cake/I18n/L10n.php
2013-11-11 11:03:57 +01:00
ADmad
d9ca148499 Merge branch 'master' into 2.5
Conflicts:
	CONTRIBUTING.md
	lib/Cake/Model/Model.php
	lib/Cake/VERSION.txt
2013-10-30 02:34:09 +05:30
Bryan Crowe
a943ea5c34 Add space between classname(s) 2013-10-22 22:59:50 -04:00
mark_story
5a394c379a Merge branch 'master' into 2.5 2013-10-14 22:57:50 -04:00
euromark
1cb24ae537 CS fixes using phpcs-fixer auto-correction. 2013-10-12 01:27:00 +02:00
Jose Lorenzo Rodriguez
df549898ad Merge remote-tracking branch 'origin/2.5' into k-halaburda-master 2013-10-12 01:05:02 +02:00
Bryan Crowe
c1dd0e4393 Changed url to URL where appropriate 2013-10-07 23:17:58 -04:00
mark_story
5e9b22271a Merge branch 'master' into 2.5 2013-09-27 22:26:33 -04:00
euromark
df269ba0ef Cake to CakePHP name 2013-09-27 19:36:43 +02:00
euromark
cbbd3ec6b3 correct doc block 2013-09-20 19:31:16 +02:00
euromark
b6a7cb7c7e Output overall coverage. 2013-09-20 19:15:51 +02:00
euromark
959988cfa1 Remove last yoda conditions as per coding standards guidelines. 2013-09-06 18:36:57 +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
ADmad
38b050a711 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Console/Command/ConsoleShell.php
2013-08-04 19:26:55 +05:30
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