Skip to content
Permalink
Browse files

Use adventage of newer PHPUnit sytax

  • Loading branch information...
keradus committed Nov 11, 2017
1 parent 9303632 commit c936250731cc5b4f8160a50150971e586442fd4d
Showing with 673 additions and 673 deletions.
  1. +2 −2 tests/TestCase/Auth/BasicAuthenticateTest.php
  2. +1 −1 tests/TestCase/Auth/ControllerAuthorizeTest.php
  3. +4 −4 tests/TestCase/Auth/DigestAuthenticateTest.php
  4. +2 −2 tests/TestCase/Auth/PasswordHasherFactoryTest.php
  5. +10 −10 tests/TestCase/Cache/CacheTest.php
  6. +4 −4 tests/TestCase/Cache/Engine/MemcachedEngineTest.php
  7. +5 −5 tests/TestCase/Collection/CollectionTest.php
  8. +1 −1 tests/TestCase/Collection/Iterator/MapReduceTest.php
  9. +6 −6 tests/TestCase/Console/CommandCollectionTest.php
  10. +6 −6 tests/TestCase/Console/CommandRunnerTest.php
  11. +8 −8 tests/TestCase/Console/ConsoleOptionParserTest.php
  12. +2 −2 tests/TestCase/Console/ConsoleOutputTest.php
  13. +2 −2 tests/TestCase/Console/HelpFormatterTest.php
  14. +1 −1 tests/TestCase/Console/HelperRegistryTest.php
  15. +2 −2 tests/TestCase/Console/ShellDispatcherTest.php
  16. +1 −1 tests/TestCase/Console/TaskRegistryTest.php
  17. +5 −5 tests/TestCase/Controller/Component/AuthComponentTest.php
  18. +4 −4 tests/TestCase/Controller/Component/CookieComponentTest.php
  19. +4 −4 tests/TestCase/Controller/Component/CsrfComponentTest.php
  20. +3 −3 tests/TestCase/Controller/Component/PaginatorComponentTest.php
  21. +1 −1 tests/TestCase/Controller/Component/RequestHandlerComponentTest.php
  22. +11 −11 tests/TestCase/Controller/Component/SecurityComponentTest.php
  23. +3 −3 tests/TestCase/Controller/ComponentRegistryTest.php
  24. +4 −4 tests/TestCase/Controller/ComponentTest.php
  25. +8 −8 tests/TestCase/Controller/ControllerTest.php
  26. +3 −3 tests/TestCase/Core/Configure/Engine/IniConfigTest.php
  27. +7 −7 tests/TestCase/Core/Configure/Engine/JsonConfigTest.php
  28. +4 −4 tests/TestCase/Core/Configure/Engine/PhpConfigTest.php
  29. +4 −4 tests/TestCase/Core/ConfigureTest.php
  30. +6 −6 tests/TestCase/Core/InstanceConfigTraitTest.php
  31. +4 −4 tests/TestCase/Core/PluginTest.php
  32. +1 −1 tests/TestCase/Core/StaticConfigTraitTest.php
  33. +11 −11 tests/TestCase/Database/ConnectionTest.php
  34. +2 −2 tests/TestCase/Database/Driver/SqlserverTest.php
  35. +2 −2 tests/TestCase/Database/DriverTest.php
  36. +2 −2 tests/TestCase/Database/Log/LoggingStatementTest.php
  37. +16 −16 tests/TestCase/Database/QueryTest.php
  38. +1 −1 tests/TestCase/Database/Schema/CollectionTest.php
  39. +3 −3 tests/TestCase/Database/Schema/TableTest.php
  40. +2 −2 tests/TestCase/Database/Type/BinaryTypeTest.php
  41. +2 −2 tests/TestCase/Database/Type/BoolTypeTest.php
  42. +2 −2 tests/TestCase/Database/Type/DecimalTypeTest.php
  43. +1 −1 tests/TestCase/Database/Type/FloatTypeTest.php
  44. +1 −1 tests/TestCase/Database/Type/IntegerTypeTest.php
  45. +1 −1 tests/TestCase/Database/Type/JsonTypeTest.php
  46. +1 −1 tests/TestCase/Database/Type/StringTypeTest.php
  47. +1 −1 tests/TestCase/Database/TypeTest.php
  48. +10 −10 tests/TestCase/Datasource/ConnectionManagerTest.php
  49. +6 −6 tests/TestCase/Datasource/FactoryLocatorTest.php
  50. +2 −2 tests/TestCase/Datasource/ModelAwareTraitTest.php
  51. +1 −1 tests/TestCase/Datasource/PaginatorTest.php
  52. +2 −2 tests/TestCase/Datasource/QueryCacherTest.php
  53. +2 −2 tests/TestCase/Error/DebuggerTest.php
  54. +2 −2 tests/TestCase/Error/Middleware/ErrorHandlerMiddlewareTest.php
  55. +2 −2 tests/TestCase/Event/Decorator/ConditionDecoratorTest.php
  56. +2 −2 tests/TestCase/Filesystem/FolderTest.php
  57. +10 −10 tests/TestCase/Http/ActionDispatcherTest.php
  58. +2 −2 tests/TestCase/Http/Client/Adapter/StreamTest.php
  59. +1 −1 tests/TestCase/Http/Client/Auth/OauthTest.php
  60. +1 −1 tests/TestCase/Http/Client/RequestTest.php
  61. +6 −6 tests/TestCase/Http/ClientTest.php
  62. +10 −10 tests/TestCase/Http/ControllerFactoryTest.php
  63. +2 −2 tests/TestCase/Http/Cookie/CookieCollectionTest.php
  64. +20 −20 tests/TestCase/Http/Cookie/CookieTest.php
  65. +4 −4 tests/TestCase/Http/Middleware/CsrfProtectionMiddlewareTest.php
  66. +4 −4 tests/TestCase/Http/Middleware/SecurityHeadersMiddlewareTest.php
  67. +2 −2 tests/TestCase/Http/MiddlewareQueueTest.php
  68. +8 −8 tests/TestCase/Http/ResponseTest.php
  69. +2 −2 tests/TestCase/Http/RunnerTest.php
  70. +10 −10 tests/TestCase/Http/ServerRequestTest.php
  71. +4 −4 tests/TestCase/Http/ServerTest.php
  72. +4 −4 tests/TestCase/I18n/Formatter/IcuFormatterTest.php
  73. +2 −2 tests/TestCase/I18n/TranslatorFactoryTest.php
  74. +6 −6 tests/TestCase/Log/LogTest.php
  75. +24 −24 tests/TestCase/Mailer/EmailTest.php
  76. +2 −2 tests/TestCase/Mailer/MailerAwareTraitTest.php
  77. +2 −2 tests/TestCase/Mailer/MailerTest.php
  78. +16 −16 tests/TestCase/Mailer/Transport/SmtpTransportTest.php
  79. +2 −2 tests/TestCase/Network/Session/CacheSessionTest.php
  80. +2 −2 tests/TestCase/Network/SessionTest.php
  81. +6 −6 tests/TestCase/Network/SocketTest.php
  82. +18 −18 tests/TestCase/ORM/Association/BelongsToManyTest.php
  83. +2 −2 tests/TestCase/ORM/Association/BelongsToTest.php
  84. +6 −6 tests/TestCase/ORM/Association/HasManyTest.php
  85. +2 −2 tests/TestCase/ORM/Association/HasOneTest.php
  86. +2 −2 tests/TestCase/ORM/AssociationCollectionTest.php
  87. +2 −2 tests/TestCase/ORM/AssociationProxyTest.php
  88. +6 −6 tests/TestCase/ORM/AssociationTest.php
  89. +2 −2 tests/TestCase/ORM/Behavior/TimestampBehaviorTest.php
  90. +7 −7 tests/TestCase/ORM/Behavior/TreeBehaviorTest.php
  91. +15 −15 tests/TestCase/ORM/BehaviorRegistryTest.php
  92. +4 −4 tests/TestCase/ORM/BehaviorTest.php
  93. +4 −4 tests/TestCase/ORM/CompositeKeysTest.php
  94. +2 −2 tests/TestCase/ORM/EntityTest.php
  95. +4 −4 tests/TestCase/ORM/Locator/TableLocatorTest.php
  96. +6 −6 tests/TestCase/ORM/MarshallerTest.php
  97. +2 −2 tests/TestCase/ORM/QueryRegressionTest.php
  98. +4 −4 tests/TestCase/ORM/QueryTest.php
  99. +2 −2 tests/TestCase/ORM/RulesCheckerIntegrationTest.php
  100. +1 −1 tests/TestCase/ORM/TableRegressionTest.php
  101. +29 −29 tests/TestCase/ORM/TableTest.php
  102. +1 −1 tests/TestCase/Routing/DispatcherFactoryTest.php
  103. +2 −2 tests/TestCase/Routing/DispatcherFilterTest.php
  104. +12 −12 tests/TestCase/Routing/DispatcherTest.php
  105. +1 −1 tests/TestCase/Routing/Middleware/RoutingMiddlewareTest.php
  106. +33 −33 tests/TestCase/Routing/Route/RedirectRouteTest.php
  107. +2 −2 tests/TestCase/Routing/Route/RouteTest.php
  108. +11 −11 tests/TestCase/Routing/RouteBuilderTest.php
  109. +16 −16 tests/TestCase/Routing/RouteCollectionTest.php
  110. +9 −9 tests/TestCase/Routing/RouterTest.php
  111. +1 −1 tests/TestCase/Shell/Helper/ProgressHelperTest.php
  112. +2 −2 tests/TestCase/Shell/OrmCacheShellTest.php
  113. +1 −1 tests/TestCase/TestSuite/Constraint/EventFiredWithTest.php
  114. +2 −2 tests/TestCase/TestSuite/FixtureManagerTest.php
  115. +17 −17 tests/TestCase/TestSuite/IntegrationTestCaseTest.php
  116. +2 −2 tests/TestCase/TestSuite/TestCaseTest.php
  117. +3 −3 tests/TestCase/TestSuite/TestFixtureTest.php
  118. +1 −1 tests/TestCase/Utility/Crypto/OpenSslTest.php
  119. +8 −8 tests/TestCase/Utility/HashTest.php
  120. +8 −8 tests/TestCase/Utility/SecurityTest.php
  121. +1 −1 tests/TestCase/Utility/TextTest.php
  122. +5 −5 tests/TestCase/Utility/XmlTest.php
  123. +2 −2 tests/TestCase/Validation/ValidationRuleTest.php
  124. +2 −2 tests/TestCase/Validation/ValidationTest.php
  125. +5 −5 tests/TestCase/Validation/ValidatorTest.php
  126. +4 −4 tests/TestCase/View/CellTest.php
  127. +4 −4 tests/TestCase/View/Form/EntityContextTest.php
  128. +1 −1 tests/TestCase/View/Helper/BreadcrumbsHelperTest.php
  129. +1 −1 tests/TestCase/View/Helper/FlashHelperTest.php
  130. +6 −6 tests/TestCase/View/Helper/FormHelperTest.php
  131. +8 −8 tests/TestCase/View/HelperRegistryTest.php
  132. +4 −4 tests/TestCase/View/StringTemplateTest.php
  133. +2 −2 tests/TestCase/View/ViewBuilderTest.php
  134. +8 −8 tests/TestCase/View/ViewTest.php
  135. +2 −2 tests/TestCase/View/ViewVarsTraitTest.php
  136. +8 −8 tests/TestCase/View/Widget/WidgetRegistryTest.php
@@ -214,12 +214,12 @@ public function testAuthenticateSuccess()
/**
* test scope failure.
*
* @expectedException \Cake\Network\Exception\UnauthorizedException
* @expectedExceptionCode 401
* @return void
*/
public function testAuthenticateFailReChallenge()
{
$this->expectException(\Cake\Network\Exception\UnauthorizedException::class);
$this->expectExceptionCode(401);
$this->auth->config('scope.username', 'nate');
$request = new ServerRequest([
'url' => 'posts/index',
@@ -49,11 +49,11 @@ public function setUp()
}
/**
* @expectedException \Cake\Core\Exception\Exception
* @return void
*/
public function testControllerErrorOnMissingMethod()
{
$this->expectException(\Cake\Core\Exception\Exception::class);
$this->auth->controller(new Controller());
}
@@ -107,12 +107,12 @@ public function testAuthenticateNoData()
/**
* test the authenticate method
*
* @expectedException \Cake\Network\Exception\UnauthorizedException
* @expectedExceptionCode 401
* @return void
*/
public function testAuthenticateWrongUsername()
{
$this->expectException(\Cake\Network\Exception\UnauthorizedException::class);
$this->expectExceptionCode(401);
$request = new ServerRequest('posts/index');
$request->addParams(['pass' => []]);
@@ -351,12 +351,12 @@ public function testAuthenticateSuccessSimulatedRequestMethod()
/**
* test scope failure.
*
* @expectedException \Cake\Network\Exception\UnauthorizedException
* @expectedExceptionCode 401
* @return void
*/
public function testAuthenticateFailReChallenge()
{
$this->expectException(\Cake\Network\Exception\UnauthorizedException::class);
$this->expectExceptionCode(401);
$this->auth->config('scope.username', 'nate');
$request = new ServerRequest([
'url' => 'posts/index',
@@ -49,12 +49,12 @@ public function testBuild()
/**
* test build() throws exception for non existent hasher
*
* @expectedException \RuntimeException
* @expectedExceptionMessage Password hasher class "FooBar" was not found.
* @return void
*/
public function testBuildException()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Password hasher class "FooBar" was not found.');
$hasher = PasswordHasherFactory::build('FooBar');
}
}
@@ -293,33 +293,33 @@ public function testConfigWithLibAndPluginEngines()
/**
* Test write from a config that is undefined.
*
* @expectedException \InvalidArgumentException
* @return void
*/
public function testWriteNonExistingConfig()
{
$this->expectException(\InvalidArgumentException::class);
$this->assertFalse(Cache::write('key', 'value', 'totally fake'));
}
/**
* Test write from a config that is undefined.
*
* @expectedException \InvalidArgumentException
* @return void
*/
public function testIncrementNonExistingConfig()
{
$this->expectException(\InvalidArgumentException::class);
$this->assertFalse(Cache::increment('key', 1, 'totally fake'));
}
/**
* Test write from a config that is undefined.
*
* @expectedException \InvalidArgumentException
* @return void
*/
public function testDecrementNonExistingConfig()
{
$this->expectException(\InvalidArgumentException::class);
$this->assertFalse(Cache::decrement('key', 1, 'totally fake'));
}
@@ -364,11 +364,11 @@ public function testConfigVariants($config)
/**
* testConfigInvalidEngine method
*
* @expectedException \BadMethodCallException
* @return void
*/
public function testConfigInvalidEngine()
{
$this->expectException(\BadMethodCallException::class);
$config = ['engine' => 'Imaginary'];
Cache::setConfig('test', $config);
Cache::engine('test');
@@ -377,11 +377,11 @@ public function testConfigInvalidEngine()
/**
* test that trying to configure classes that don't extend CacheEngine fail.
*
* @expectedException \BadMethodCallException
* @return void
*/
public function testConfigInvalidObject()
{
$this->expectException(\BadMethodCallException::class);
$this->getMockBuilder(\StdClass::class)
->setMockClassName('RubbishEngine')
->getMock();
@@ -394,11 +394,11 @@ public function testConfigInvalidObject()
/**
* Ensure you cannot reconfigure a cache adapter.
*
* @expectedException \BadMethodCallException
* @return void
*/
public function testConfigErrorOnReconfigure()
{
$this->expectException(\BadMethodCallException::class);
Cache::setConfig('tests', ['engine' => 'File', 'path' => TMP]);
Cache::setConfig('tests', ['engine' => 'Apc']);
}
@@ -518,10 +518,10 @@ public function testGroupConfigsWithCacheInstance()
/**
* testGroupConfigsThrowsException method
* @expectedException \InvalidArgumentException
*/
public function testGroupConfigsThrowsException()
{
$this->expectException(\InvalidArgumentException::class);
Cache::groupConfigs('bogus');
}
@@ -589,12 +589,12 @@ public function testWriteEmptyValues()
/**
* testWriteEmptyValues method
*
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage An empty value is not valid as a cache key
* @return void
*/
public function testWriteEmptyKey()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('An empty value is not valid as a cache key');
$this->_configCache();
Cache::write(null, 'not null', 'tests');
}
@@ -656,11 +656,11 @@ public function testDeleteMany()
/**
* Test that failed writes cause errors to be triggered.
*
* @expectedException \PHPUnit\Framework\Error\Error
* @return void
*/
public function testWriteTriggerError()
{
$this->expectException(\PHPUnit\Framework\Error\Error::class);
static::setAppNamespace();
Cache::setConfig('test_trigger', [
'engine' => 'TestAppCache',
@@ -152,12 +152,12 @@ public function testOptionsSetting()
/**
* test accepts only valid serializer engine
*
* @expectedException InvalidArgumentException
* @expectedExceptionMessage invalid_serializer is not a valid serializer engine for Memcached
* @return void
*/
public function testInvalidSerializerSetting()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('invalid_serializer is not a valid serializer engine for Memcached');
$Memcached = new MemcachedEngine();
$config = [
'className' => 'Memcached',
@@ -338,12 +338,12 @@ public function testIgbinarySerializerThrowException()
* test using authentication without memcached installed with SASL support
* throw an exception
*
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Memcached extension is not build with SASL support
* @return void
*/
public function testSaslAuthException()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Memcached extension is not build with SASL support');
$this->skipIf(
method_exists(Memcached::class, 'setSaslAuthData'),
'Cannot test exception when sasl has been compiled in.'
@@ -975,23 +975,23 @@ public function testToJson()
/**
* Tests that only arrays and Traversables are allowed in the constructor
*
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Only an array or \Traversable is allowed for Collection
* @return void
*/
public function testInvalidConstructorArgument()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Only an array or \Traversable is allowed for Collection');
new Collection('Derp');
}
/**
* Tests that issuing a count will throw an exception
*
* @expectedException \LogicException
* @return void
*/
public function testCollectionCount()
{
$this->expectException(\LogicException::class);
$data = [1, 2, 3, 4];
$collection = new Collection($data);
$collection->count();
@@ -2429,11 +2429,11 @@ public function testCartesianProduct()
/**
* Tests that an exception is thrown if the cartesian product is called with multidimensional arrays
*
* @expectedException \LogicException
* @return void
*/
public function testCartesianProductMultidimensionalArray()
{
$this->expectException(\LogicException::class);
$collection = new Collection([
[
'names' => [
@@ -2473,11 +2473,11 @@ public function testTranspose()
/**
* Tests that provided arrays do not have even length
*
* @expectedException \LogicException
* @return void
*/
public function testTransposeUnEvenLengthShouldThrowException()
{
$this->expectException(\LogicException::class);
$collection = new Collection([
['Products', '2012', '2013', '2014'],
['Product A', '200', '100', '50'],
@@ -88,11 +88,11 @@ public function testEmitFinalInMapper()
/**
* Tests that a reducer is required when there are intermediate results
*
* @expectedException \LogicException
* @return void
*/
public function testReducerRequired()
{
$this->expectException(\LogicException::class);
$data = ['a' => ['one', 'two'], 'b' => ['three', 'four']];
$mapper = function ($row, $key, $mr) {
foreach ($row as $number) {
@@ -53,11 +53,11 @@ public function testConstructor()
* Constructor with invalid class names should blow up
*
* @return void
* @expectedException InvalidArgumentException
* @expectedExceptionMessage Cannot use 'stdClass' for command 'nope' it is not a subclass of Cake\Console\Shell
*/
public function testConstructorInvalidClass()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot use \'stdClass\' for command \'nope\' it is not a subclass of Cake\Console\Shell');
new CommandCollection([
'i18n' => I18nShell::class,
'nope' => stdClass::class
@@ -112,11 +112,11 @@ public function testAddInstance()
/**
* Instances that are not shells should fail.
*
* @expectedException InvalidArgumentException
* @expectedExceptionMessage Cannot use 'stdClass' for command 'routes' it is not a subclass of Cake\Console\Shell
*/
public function testAddInvalidInstance()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot use \'stdClass\' for command \'routes\' it is not a subclass of Cake\Console\Shell');
$collection = new CommandCollection();
$shell = new stdClass();
$collection->add('routes', $shell);
@@ -125,11 +125,11 @@ public function testAddInvalidInstance()
/**
* Class names that are not shells should fail
*
* @expectedException InvalidArgumentException
* @expectedExceptionMessage Cannot use 'stdClass' for command 'routes' it is not a subclass of Cake\Console\Shell
*/
public function testInvalidShellClassName()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Cannot use \'stdClass\' for command \'routes\' it is not a subclass of Cake\Console\Shell');
$collection = new CommandCollection();
$collection->add('routes', stdClass::class);
}
@@ -52,12 +52,12 @@ public function setUp()
* Test that the console hook not returning a command collection
* raises an error.
*
* @expectedException \RuntimeException
* @expectedExceptionMessage The application's `console` method did not return a CommandCollection.
* @return void
*/
public function testRunConsoleHookFailure()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('The application\'s `console` method did not return a CommandCollection.');
$app = $this->getMockBuilder(BaseApplication::class)
->setMethods(['console', 'middleware', 'bootstrap'])
->setConstructorArgs([$this->config])
@@ -69,12 +69,12 @@ public function testRunConsoleHookFailure()
/**
* Test that running with empty argv fails
*
* @expectedException \RuntimeException
* @expectedExceptionMessage Cannot run any commands. No arguments received.
* @return void
*/
public function testRunMissingRootCommand()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Cannot run any commands. No arguments received.');
$app = $this->getMockBuilder(BaseApplication::class)
->setMethods(['middleware', 'bootstrap'])
->setConstructorArgs([$this->config])
@@ -87,12 +87,12 @@ public function testRunMissingRootCommand()
/**
* Test that running an unknown command raises an error.
*
* @expectedException \RuntimeException
* @expectedExceptionMessage Unknown command `cake nope`. Run `cake --help` to get the list of valid commands.
* @return void
*/
public function testRunInvalidCommand()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Unknown command `cake nope`. Run `cake --help` to get the list of valid commands.');
$app = $this->getMockBuilder(BaseApplication::class)
->setMethods(['middleware', 'bootstrap'])
->setConstructorArgs([$this->config])
Oops, something went wrong.

0 comments on commit c936250

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