Repository: phoenixframework/phoenix (elixir)

Issue:
Generated tests for phx.gen.json fail because of different timestamp format
### Environment

* Elixir version (elixir -v): Elixir 1.7.3 (compiled with Erlang/OTP 21)
* Phoenix version (mix deps):   1.4.0-rc.1
* NodeJS version (node -v): v10.11.0
* NPM version (npm -v): 6.4.1
* Operating system: Linux

### Expected behavior
Generated tests for command `mix phx.gen.json` succeed out of the box

### Actual behavior
Tests fail:

```
.....

  1) test create user renders user when data is valid (DeviceHubWeb.UserControllerTest)
     test/device_hub_web/controllers/user_controller_test.exs:38
     match (=) failed
     code:  assert %{"id" => id, "email" => "some email", "password" => "some password", "reset_code" => "some reset_code", "reset_code_valid_to" => "2010-04-17 14:00:00.000000Z"} = json_response(conn, 200)["data"]
     right: %{
              "email" => "some email",
              "id" => 171,
              "password" => "some password",
              "reset_code" => "some reset_code",
              "reset_code_valid_to" => "2010-04-17T14:00:00.000000Z"
            }
     stacktrace:
       test/device_hub_web/controllers/user_controller_test.exs:44: (test)

.

  2) test update user renders user when data is valid (DeviceHubWeb.UserControllerTest)
     test/device_hub_web/controllers/user_controller_test.exs:62
     match (=) failed
     code:  assert %{"id" => id, "email" => "some updated email", "password" => "some updated password", "reset_code" => "some updated reset_code", "reset_code_valid_to" => "2011-05-18 15:01:01.000000Z"} = json_response(conn, 200)["data"]
     right: %{
              "email" => "some updated email",
              "id" => 172,
              "password" => "some updated password",
              "reset_code" => "some updated reset_code",
              "reset_code_valid_to" => "2011-05-18T15:01:01.000000Z"
            }
     stacktrace:
       test/device_hub_web/controllers/user_controller_test.exs:68: (test)

.

Finished in 0.1 seconds
9 tests, 2 failures
```
The difference causing the failed tests is the missing 'T' character inside the utc_timestamp field.

Pull request description:
Fix :utc_datetime default params string representation
Add the T separator so the string roundtrips when transformed to a
DateTime and then encoded back by the JSON encoder

Fix #3097 

Patch:
diff --git a/lib/mix/phoenix/schema.ex b/lib/mix/phoenix/schema.ex
index 129009785..865566b60 100644
--- a/lib/mix/phoenix/schema.ex
+++ b/lib/mix/phoenix/schema.ex
@@ -190,7 +190,7 @@ defmodule Mix.Phoenix.Schema do
         :date           -> %Date{year: 2010, month: 4, day: 17}
         :time           -> %Time{hour: 14, minute: 0, second: 0, microsecond: {0, 6}}
         :uuid           -> "7488a646-e31f-11e4-aace-600308960662"
-        :utc_datetime   -> "2010-04-17 14:00:00.000000Z"
+        :utc_datetime   -> "2010-04-17T14:00:00.000000Z"
         :naive_datetime -> ~N[2010-04-17 14:00:00.000000]
         _               -> "some #{key}"
     end
@@ -207,7 +207,7 @@ defmodule Mix.Phoenix.Schema do
         :date           -> %Date{year: 2011, month: 5, day: 18}
         :time           -> %Time{hour: 15, minute: 1, second: 1, microsecond: {0, 6}}
         :uuid           -> "7488a646-e31f-11e4-aace-600308960668"
-        :utc_datetime   -> "2011-05-18 15:01:01.000000Z"
+        :utc_datetime   -> "2011-05-18T15:01:01.000000Z"
         :naive_datetime -> ~N[2011-05-18 15:01:01.000000]
         _               -> "some updated #{key}"
     end


Test patch:
diff --git a/test/mix/tasks/phx.gen.html_test.exs b/test/mix/tasks/phx.gen.html_test.exs
index 7151cd036..aa298b85a 100644
--- a/test/mix/tasks/phx.gen.html_test.exs
+++ b/test/mix/tasks/phx.gen.html_test.exs
@@ -49,12 +49,12 @@ defmodule Mix.Tasks.Phx.Gen.HtmlTest do
         assert file =~ "announcement_date: ~D[2010-04-17]"
         assert file =~ "deleted_at: ~N[2010-04-17 14:00:00.000000]"
         assert file =~ "cost: \"120.5\""
-        assert file =~ "published_at: \"2010-04-17 14:00:00.000000Z\""
+        assert file =~ "published_at: \"2010-04-17T14:00:00.000000Z\""
         assert file =~ "weight: 120.5"
 
         assert file =~ "assert post.announcement_date == ~D[2011-05-18]"
         assert file =~ "assert post.deleted_at == ~N[2011-05-18 15:01:01.000000]"
-        assert file =~ "assert post.published_at == DateTime.from_naive!(~N[2011-05-18 15:01:01.000000Z], \"Etc/UTC\")"
+        assert file =~ "assert post.published_at == DateTime.from_naive!(~N[2011-05-18T15:01:01.000000Z], \"Etc/UTC\")"
         assert file =~ "assert post.alarm == ~T[15:01:01.000000]"
         assert file =~ "assert post.cost == Decimal.new(\"120.5\")"
         assert file =~ "assert post.weight == 120.5"
diff --git a/test/mix/tasks/phx.gen.json_test.exs b/test/mix/tasks/phx.gen.json_test.exs
index d124f7575..644b7558c 100644
--- a/test/mix/tasks/phx.gen.json_test.exs
+++ b/test/mix/tasks/phx.gen.json_test.exs
@@ -61,7 +61,7 @@ defmodule Mix.Tasks.Phx.Gen.JsonTest do
                        "deleted_at" => "2010-04-17T14:00:00.000000",
                        "drafted_at" => "2010-04-17T14:00:00.000000",
                        "popular" => true,
-                       "published_at" => "2010-04-17 14:00:00.000000Z",
+                       "published_at" => "2010-04-17T14:00:00.000000Z",
                        "secret" => "7488a646-e31f-11e4-aace-600308960662",
                        "slug" => "some slug",
                        "tags" => [],