Skip to content
Permalink
Browse files

Throw warning when using underscored fixture names.

This will allow us to drop the implicit inflecting to CameCased names in fixture manager.
  • Loading branch information...
ADmad committed Sep 13, 2018
1 parent 7f33677 commit f86a585210543c00cc55c62145f68760a744d90d
Showing with 164 additions and 140 deletions.
  1. +25 −1 src/TestSuite/Fixture/FixtureManager.php
  2. +1 −1 tests/Fixture/FixturizedTestCase.php
  3. +1 −1 tests/TestCase/Auth/BasicAuthenticateTest.php
  4. +1 −1 tests/TestCase/Auth/DigestAuthenticateTest.php
  5. +1 −1 tests/TestCase/Auth/FormAuthenticateTest.php
  6. +7 −7 tests/TestCase/Console/ShellTest.php
  7. +1 −1 tests/TestCase/Controller/Component/AuthComponentTest.php
  8. +2 −2 tests/TestCase/Controller/Component/PaginatorComponentTest.php
  9. +2 −2 tests/TestCase/Controller/ControllerTest.php
  10. +1 −1 tests/TestCase/Database/ConnectionTest.php
  11. +1 −1 tests/TestCase/Database/ExpressionTypeCastingIntegrationTest.php
  12. +5 −5 tests/TestCase/Database/QueryTest.php
  13. +1 −1 tests/TestCase/Database/Schema/CollectionTest.php
  14. +5 −5 tests/TestCase/Database/Schema/TableSchemaTest.php
  15. +1 −1 tests/TestCase/Database/SchemaCacheTest.php
  16. +2 −2 tests/TestCase/Datasource/PaginatorTest.php
  17. +1 −1 tests/TestCase/Http/Session/DatabaseSessionTest.php
  18. +1 −1 tests/TestCase/Mailer/EmailTest.php
  19. +1 −1 tests/TestCase/ORM/Association/BelongsToManyTest.php
  20. +1 −1 tests/TestCase/ORM/Association/BelongsToTest.php
  21. +1 −1 tests/TestCase/ORM/Association/HasManyTest.php
  22. +1 −1 tests/TestCase/ORM/Association/HasOneTest.php
  23. +1 −1 tests/TestCase/ORM/AssociationProxyTest.php
  24. +2 −2 tests/TestCase/ORM/Behavior/BehaviorRegressionTest.php
  25. +5 −5 tests/TestCase/ORM/Behavior/CounterCacheBehaviorTest.php
  26. +1 −1 tests/TestCase/ORM/Behavior/TimestampBehaviorTest.php
  27. +7 −7 tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php
  28. +2 −2 tests/TestCase/ORM/Behavior/TreeBehaviorTest.php
  29. +3 −3 tests/TestCase/ORM/BindingKeyTest.php
  30. +5 −5 tests/TestCase/ORM/CompositeKeysTest.php
  31. +6 −6 tests/TestCase/ORM/MarshallerTest.php
  32. +11 −11 tests/TestCase/ORM/QueryRegressionTest.php
  33. +7 −7 tests/TestCase/ORM/QueryTest.php
  34. +1 −1 tests/TestCase/ORM/ResultSetTest.php
  35. +3 −3 tests/TestCase/ORM/RulesCheckerIntegrationTest.php
  36. +4 −4 tests/TestCase/ORM/SaveOptionsBuilderTest.php
  37. +1 −1 tests/TestCase/ORM/TableRegressionTest.php
  38. +12 −12 tests/TestCase/ORM/TableTest.php
  39. +2 −2 tests/TestCase/ORM/TableUuidTest.php
  40. +1 −1 tests/TestCase/Routing/RequestActionTraitTest.php
  41. +1 −1 tests/TestCase/Shell/SchemaCacheShellTest.php
  42. +21 −21 tests/TestCase/TestSuite/FixtureManagerTest.php
  43. +1 −1 tests/TestCase/TestSuite/TestFixtureTest.php
  44. +1 −1 tests/TestCase/Utility/XmlTest.php
  45. +1 −1 tests/TestCase/View/Form/EntityContextTest.php
  46. +1 −1 tests/TestCase/View/Helper/FormHelperTest.php
  47. +1 −1 tests/TestCase/View/ViewTest.php
@@ -190,19 +190,43 @@ protected function _loadFixtures($test)
list($plugin, $name) = explode('.', $pathName);
// Flip vendored plugin separators
$path = str_replace('/', '\\', $plugin);
$uninflected = $path;
$baseNamespace = Inflector::camelize(str_replace('\\', '\ ', $path));
if ($baseNamespace !== $uninflected) {
deprecationWarning(sprintf(
'Declaring fixtures in underscored format in TestCase::$fixtures is deprecated.' . "\n" .
'Expected "%s" instead in "%s".',
str_replace('\\', '/', $baseNamespace),
get_class($test)
));
}
$additionalPath = null;
} else {
$baseNamespace = '';
$name = $fixture;
}
$uninflected = $name;
// Tweak subdirectory names, so camelize() can make the correct name
if (strpos($name, '/') > 0) {
$name = str_replace('/', '\\ ', $name);
$name = str_replace('/', '\\', $name);
$uninflected = $name;
$name = str_replace('\\', '\ ', $name);
}
$name = Inflector::camelize($name);
if ($name !== $uninflected) {
deprecationWarning(sprintf(
'Declaring fixtures in underscored format in TestCase::$fixtures is deprecated.' . "\n" .
'Found "%s.%s" in "%s". Expected "%s.%s" instead.',
$type,
$uninflected,
get_class($test),
$type,
str_replace('\\', '/', $name)
));
}
$nameSegments = [
$baseNamespace,
'Test\Fixture',
@@ -14,7 +14,7 @@ class FixturizedTestCase extends TestCase
* Fixtures to use in this test
* @var array
*/
public $fixtures = ['core.categories', 'core.articles'];
public $fixtures = ['core.Categories', 'core.Articles'];
/**
* test that the shared fixture is correctly set
@@ -33,7 +33,7 @@ class BasicAuthenticateTest extends TestCase
*
* @var array
*/
public $fixtures = ['core.auth_users', 'core.users'];
public $fixtures = ['core.AuthUsers', 'core.Users'];
/**
* setup
@@ -45,7 +45,7 @@ class DigestAuthenticateTest extends TestCase
*
* @var array
*/
public $fixtures = ['core.auth_users', 'core.users'];
public $fixtures = ['core.AuthUsers', 'core.Users'];
/**
* setup
@@ -35,7 +35,7 @@ class FormAuthenticateTest extends TestCase
*
* @var array
*/
public $fixtures = ['core.auth_users', 'core.users'];
public $fixtures = ['core.AuthUsers', 'core.Users'];
/**
* setup
@@ -53,13 +53,13 @@ class ShellTest extends TestCase
* @var array
*/
public $fixtures = [
'core.articles',
'core.articles_tags',
'core.attachments',
'core.comments',
'core.posts',
'core.tags',
'core.users'
'core.Articles',
'core.ArticlesTags',
'core.Attachments',
'core.Comments',
'core.Posts',
'core.Tags',
'core.Users'
];
/** @var \Cake\Console\Shell */
@@ -47,7 +47,7 @@ class AuthComponentTest extends TestCase
*
* @var array
*/
public $fixtures = ['core.auth_users', 'core.users'];
public $fixtures = ['core.AuthUsers', 'core.Users'];
/**
* setUp method
@@ -57,8 +57,8 @@ class PaginatorComponentTest extends TestCase
* @var array
*/
public $fixtures = [
'core.posts', 'core.articles', 'core.articles_tags',
'core.authors', 'core.authors_tags', 'core.tags'
'core.Posts', 'core.Articles', 'core.ArticlesTags',
'core.Authors', 'core.AuthorsTags', 'core.Tags'
];
/**
@@ -231,8 +231,8 @@ class ControllerTest extends TestCase
* @var array
*/
public $fixtures = [
'core.comments',
'core.posts'
'core.Comments',
'core.Posts'
];
/**
@@ -36,7 +36,7 @@
class ConnectionTest extends TestCase
{
public $fixtures = ['core.things'];
public $fixtures = ['core.Things'];
/**
* Where the NestedTransactionRollbackException was created.
@@ -73,7 +73,7 @@ public function toExpression($value)
class ExpressionTypeCastingIntegrationTest extends TestCase
{
public $fixtures = ['core.ordered_uuid_items'];
public $fixtures = ['core.OrderedUuidItems'];
public function setUp()
{
@@ -31,11 +31,11 @@ class QueryTest extends TestCase
{
public $fixtures = [
'core.articles',
'core.authors',
'core.comments',
'core.profiles',
'core.menu_link_trees'
'core.Articles',
'core.Authors',
'core.Comments',
'core.Profiles',
'core.MenuLinkTrees'
];
public $autoFixtures = false;
@@ -33,7 +33,7 @@ class CollectionTest extends TestCase
* @var array
*/
public $fixtures = [
'core.users'
'core.Users'
];
/**
@@ -38,11 +38,11 @@ class TableTest extends TestCase
{
public $fixtures = [
'core.articles',
'core.tags',
'core.articles_tags',
'core.orders',
'core.products'
'core.Articles',
'core.Tags',
'core.ArticlesTags',
'core.Orders',
'core.Products'
];
protected $_map;
@@ -32,7 +32,7 @@ class SchemaCacheTest extends TestCase
*
* @var array
*/
public $fixtures = ['core.articles', 'core.tags'];
public $fixtures = ['core.Articles', 'core.Tags'];
/**
* Cache Engine Mock
@@ -31,8 +31,8 @@ class PaginatorTest extends TestCase
* @var array
*/
public $fixtures = [
'core.posts', 'core.articles', 'core.articles_tags',
'core.authors', 'core.authors_tags', 'core.tags'
'core.Posts', 'core.Articles', 'core.ArticlesTags',
'core.Authors', 'core.AuthorsTags', 'core.Tags'
];
/**
@@ -32,7 +32,7 @@ class DatabaseSessionTest extends TestCase
*
* @var string
*/
public $fixtures = ['core.sessions'];
public $fixtures = ['core.Sessions'];
/**
* setUp
@@ -106,7 +106,7 @@ public function getContentTransferEncoding()
class EmailTest extends TestCase
{
public $fixtures = ['core.users'];
public $fixtures = ['core.Users'];
/**
* @var \Cake\Mailer\Email
@@ -34,7 +34,7 @@ class BelongsToManyTest extends TestCase
*
* @var array
*/
public $fixtures = ['core.articles', 'core.special_tags', 'core.articles_tags', 'core.tags'];
public $fixtures = ['core.Articles', 'core.SpecialTags', 'core.ArticlesTags', 'core.Tags'];
/**
* Set up
@@ -32,7 +32,7 @@ class BelongsToTest extends TestCase
*
* @var array
*/
public $fixtures = ['core.articles', 'core.authors', 'core.comments'];
public $fixtures = ['core.Articles', 'core.Authors', 'core.Comments'];
/**
* Set up
@@ -35,7 +35,7 @@ class HasManyTest extends TestCase
*
* @var array
*/
public $fixtures = ['core.comments', 'core.articles', 'core.authors'];
public $fixtures = ['core.Comments', 'core.Articles', 'core.Authors'];
/**
* Set up
@@ -31,7 +31,7 @@ class HasOneTest extends TestCase
*
* @var array
*/
public $fixtures = ['core.users', 'core.profiles'];
public $fixtures = ['core.Users', 'core.Profiles'];
/**
* @var bool
@@ -29,7 +29,7 @@ class AssociationProxyTest extends TestCase
* @var array
*/
public $fixtures = [
'core.articles', 'core.authors', 'core.comments'
'core.Articles', 'core.Authors', 'core.Comments'
];
/**
@@ -38,8 +38,8 @@ class BehaviorRegressionTest extends TestCase
* @var array
*/
public $fixtures = [
'core.number_trees',
'core.translates'
'core.NumberTrees',
'core.Translates'
];
/**
@@ -46,11 +46,11 @@ class CounterCacheBehaviorTest extends TestCase
* @var array
*/
public $fixtures = [
'core.counter_cache_categories',
'core.counter_cache_posts',
'core.counter_cache_comments',
'core.counter_cache_users',
'core.counter_cache_user_category_posts'
'core.CounterCacheCategories',
'core.CounterCachePosts',
'core.CounterCacheComments',
'core.CounterCacheUsers',
'core.CounterCacheUserCategoryPosts'
];
/**
@@ -44,7 +44,7 @@ class TimestampBehaviorTest extends TestCase
* @var array
*/
public $fixtures = [
'core.users'
'core.Users'
];
/**
@@ -43,13 +43,13 @@ class TranslateBehaviorTest extends TestCase
* @var array
*/
public $fixtures = [
'core.articles',
'core.authors',
'core.groups',
'core.special_tags',
'core.tags',
'core.comments',
'core.translates'
'core.Articles',
'core.Authors',
'core.Groups',
'core.SpecialTags',
'core.Tags',
'core.Comments',
'core.Translates'
];
public function tearDown()
@@ -29,8 +29,8 @@ class TreeBehaviorTest extends TestCase
* @var array
*/
public $fixtures = [
'core.menu_link_trees',
'core.number_trees'
'core.MenuLinkTrees',
'core.NumberTrees'
];
public function setUp()
@@ -28,9 +28,9 @@ class BindingKeyTest extends TestCase
* @var array
*/
public $fixtures = [
'core.auth_users',
'core.site_authors',
'core.users'
'core.AuthUsers',
'core.SiteAuthors',
'core.Users'
];
/**
@@ -47,11 +47,11 @@ class CompositeKeyTest extends TestCase
* @var array
*/
public $fixtures = [
'core.composite_increments',
'core.site_articles',
'core.site_articles_tags',
'core.site_authors',
'core.site_tags'
'core.CompositeIncrements',
'core.SiteArticles',
'core.SiteArticlesTags',
'core.SiteAuthors',
'core.SiteTags'
];
/**
@@ -99,12 +99,12 @@ class MarshallerTest extends TestCase
{
public $fixtures = [
'core.articles',
'core.articles_tags',
'core.comments',
'core.special_tags',
'core.tags',
'core.users'
'core.Articles',
'core.ArticlesTags',
'core.Comments',
'core.SpecialTags',
'core.Tags',
'core.Users'
];
/**
Oops, something went wrong.

0 comments on commit f86a585

Please sign in to comment.
You can’t perform that action at this time.