Browse Source

Merge pull request #14858 from cakephp/uuid-cleanup

Clean up UUID fixture names
Mark Story 5 years ago
parent
commit
840e465756

+ 1 - 0
src/Console/CommandCollection.php

@@ -36,6 +36,7 @@ class CommandCollection implements IteratorAggregate, Countable
      *
      * @var array
      * @psalm-var (\Cake\Console\Shell|\Cake\Console\CommandInterface|class-string)[]
+     * @psalm-suppress DeprecatedClass
      */
     protected $commands = [];
 

+ 1 - 0
src/Console/ConsoleOptionParser.php

@@ -687,6 +687,7 @@ class ConsoleOptionParser
             array_shift($argv);
         }
         if (isset($this->_subcommands[$command]) && $this->_subcommands[$command]->parser()) {
+            /** @psalm-suppress PossiblyNullReference */
             return $this->_subcommands[$command]->parser()->parse($argv);
         }
         $params = $args = [];

+ 4 - 0
src/Http/Client/Adapter/Curl.php

@@ -103,6 +103,10 @@ class Curl implements AdapterInterface
                 $out[CURLOPT_POST] = true;
                 break;
 
+            case Request::METHOD_HEAD:
+                $out[CURLOPT_NOBODY] = true;
+                break;
+
             default:
                 $out[CURLOPT_POST] = true;
                 $out[CURLOPT_CUSTOMREQUEST] = $request->getMethod();

+ 2 - 1
src/Log/Engine/BaseLog.php

@@ -18,6 +18,7 @@ namespace Cake\Log\Engine;
 
 use ArrayObject;
 use Cake\Core\InstanceConfigTrait;
+use DateTimeImmutable;
 use JsonSerializable;
 use Psr\Log\AbstractLogger;
 use Serializable;
@@ -171,6 +172,6 @@ abstract class BaseLog extends AbstractLogger
      */
     protected function _getFormattedDate(): string
     {
-        return date($this->_config['dateFormat']);
+        return (new DateTimeImmutable())->format($this->_config['dateFormat']);
     }
 }

+ 1 - 0
src/ORM/Behavior/Translate/ShadowTableStrategy.php

@@ -452,6 +452,7 @@ class ShadowTableStrategy implements TranslateStrategyInterface
                 unset($row['translation']);
 
                 if ($hydrated) {
+                    /** @psalm-suppress PossiblyInvalidMethodCall */
                     $row->clean();
                 }
 

+ 1 - 1
src/ORM/Table.php

@@ -2509,7 +2509,7 @@ class Table implements RepositoryInterface, EventListenerInterface, EventDispatc
     }
 
     /**
-     * Provides the dynamic findBy and findByAll methods.
+     * Provides the dynamic findBy and findAllBy methods.
      *
      * @param string $method The method name that was fired.
      * @param array $args List of arguments passed to the function.

+ 2 - 2
tests/Fixture/BinaryUuiditemsFixture.php

@@ -17,9 +17,9 @@ namespace Cake\Test\Fixture;
 use Cake\TestSuite\Fixture\TestFixture;
 
 /**
- * BinaryUuiditemsFixture
+ * BinaryUuidItemsFixture
  */
-class BinaryUuiditemsFixture extends TestFixture
+class BinaryUuidItemsFixture extends TestFixture
 {
     /**
      * fields property

+ 1 - 1
tests/Fixture/UuiditemsFixture.php

@@ -19,7 +19,7 @@ use Cake\TestSuite\Fixture\TestFixture;
 /**
  * UuiditemFixture
  */
-class UuiditemsFixture extends TestFixture
+class UuidItemsFixture extends TestFixture
 {
     /**
      * fields property

+ 0 - 44
tests/Fixture/UuidportfoliosFixture.php

@@ -1,44 +0,0 @@
-<?php
-/**
- * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
- * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
- *
- * Licensed under The MIT License
- * For full copyright and license information, please see the LICENSE.txt
- * Redistributions of files must retain the above copyright notice
- *
- * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
- * @link          https://cakephp.org CakePHP(tm) Project
- * @since         1.2.0
- * @license       https://opensource.org/licenses/mit-license.php MIT License
- */
-namespace Cake\Test\Fixture;
-
-use Cake\TestSuite\Fixture\TestFixture;
-
-/**
- * UuidportfolioFixture
- */
-class UuidportfoliosFixture extends TestFixture
-{
-    /**
-     * fields property
-     *
-     * @var array
-     */
-    public $fields = [
-        'id' => ['type' => 'uuid'],
-        'name' => ['type' => 'string', 'null' => false],
-        '_constraints' => ['primary' => ['type' => 'primary', 'columns' => ['id']]],
-    ];
-
-    /**
-     * records property
-     *
-     * @var array
-     */
-    public $records = [
-        ['id' => '4806e091-6940-4d2b-b227-303740cf8569', 'name' => 'Portfolio 1'],
-        ['id' => '480af662-eb8c-47d3-886b-230540cf8569', 'name' => 'Portfolio 2'],
-    ];
-}

+ 30 - 0
tests/TestCase/Http/Client/Adapter/CurlTest.php

@@ -336,6 +336,36 @@ class CurlTest extends TestCase
      *
      * @return void
      */
+    public function testBuildOptionsHead()
+    {
+        $options = [];
+        $request = new Request(
+            'http://localhost/things',
+            'HEAD',
+            ['Cookie' => 'testing=value']
+        );
+        $result = $this->curl->buildOptions($request, $options);
+        $expected = [
+            CURLOPT_URL => 'http://localhost/things',
+            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
+            CURLOPT_RETURNTRANSFER => true,
+            CURLOPT_HEADER => true,
+            CURLOPT_HTTPHEADER => [
+                'Cookie: testing=value',
+                'Connection: close',
+                'User-Agent: CakePHP',
+            ],
+            CURLOPT_NOBODY => true,
+            CURLOPT_CAINFO => $this->caFile,
+        ];
+        $this->assertSame($expected, $result);
+    }
+
+    /**
+     * Test converting client options into curl ones.
+     *
+     * @return void
+     */
     public function testBuildOptionsCurlOptions()
     {
         $options = [

+ 3 - 3
tests/TestCase/ORM/TableUuidTest.php

@@ -31,8 +31,8 @@ class TableUuidTest extends TestCase
      * @var array
      */
     protected $fixtures = [
-        'core.BinaryUuiditems',
-        'core.Uuiditems',
+        'core.BinaryUuidItems',
+        'core.UuidItems',
     ];
 
     /**
@@ -53,7 +53,7 @@ class TableUuidTest extends TestCase
      */
     public function uuidTableProvider()
     {
-        return [['uuiditems'], ['binary_uuiditems']];
+        return [['uuid_items'], ['binary_uuid_items']];
     }
 
     /**