{"action":"created","comment":{"url":"https://api.github.com/repos/Codeception/Codeception/pulls/comments/69822539","id":69822539,"diff_hunk":"@@ -0,0 +1,67 @@\n+<?php\n+\n+namespace Codeception\\PHPUnit\\Constraint;\n+\n+use SebastianBergmann\\Comparator\\ComparisonFailure;\n+use SebastianBergmann\\Comparator\\ArrayComparator;\n+use SebastianBergmann\\Comparator\\Factory;\n+use Codeception\\Util\\JsonArray;\n+\n+class JsonContains extends \\PHPUnit_Framework_Constraint\n+{\n+    /**\n+     * @var\n+     */\n+    protected $expected;\n+\n+    public function __construct(array $expected)\n+    {\n+        parent::__construct();\n+        $this->expected = $expected;\n+    }\n+\n+    /**\n+     * Evaluates the constraint for parameter $other. Returns true if the\n+     * constraint is met, false otherwise.\n+     *\n+     * @param mixed $other Value or object to evaluate.\n+     *\n+     * @return bool\n+     */\n+    protected function matches($other)\n+    {\n+        $jsonResponseArray = new JsonArray($other);\n+\n+        if ($jsonResponseArray->containsArray($this->expected)) {\n+            return true;\n+        }\n+\n+        $comparator = new ArrayComparator();\n+        $comparator->setFactory(new Factory);\n+        try {\n+            //$comparator->assertEquals(var_export($this->expected, true), var_export($jsonResponseArray->toArray(), true));\n+            $comparator->assertEquals($this->expected, $jsonResponseArray->toArray());\n+        } catch (ComparisonFailure $failure) {\n+            throw new \\PHPUnit_Framework_ExpectationFailedException(\n+                \"Response JSON does not contain the provided JSON\\n\",\n+                $failure);","path":"src/Codeception/PHPUnit/Constraint/JsonContains.php","position":47,"original_position":47,"commit_id":"1e4df8ce92d142b123b6072d2afebd84d036f078","original_commit_id":"1e4df8ce92d142b123b6072d2afebd84d036f078","user":{"login":"Nitpick-CI","id":12626182,"avatar_url":"https://avatars.githubusercontent.com/u/12626182?v=3","gravatar_id":"","url":"https://api.github.com/users/Nitpick-CI","html_url":"https://github.com/Nitpick-CI","followers_url":"https://api.github.com/users/Nitpick-CI/followers","following_url":"https://api.github.com/users/Nitpick-CI/following{/other_user}","gists_url":"https://api.github.com/users/Nitpick-CI/gists{/gist_id}","starred_url":"https://api.github.com/users/Nitpick-CI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nitpick-CI/subscriptions","organizations_url":"https://api.github.com/users/Nitpick-CI/orgs","repos_url":"https://api.github.com/users/Nitpick-CI/repos","events_url":"https://api.github.com/users/Nitpick-CI/events{/privacy}","received_events_url":"https://api.github.com/users/Nitpick-CI/received_events","type":"User","site_admin":false},"body":"- Multi-line function call not indented correctly; expected 12 spaces but found 16\n- Closing parenthesis of a multi-line function call must be on a line by itself\n","created_at":"2016-07-06T22:23:44Z","updated_at":"2016-07-06T22:23:44Z","html_url":"https://github.com/Codeception/Codeception/pull/3320#discussion_r69822539","pull_request_url":"https://api.github.com/repos/Codeception/Codeception/pulls/3320","_links":{"self":{"href":"https://api.github.com/repos/Codeception/Codeception/pulls/comments/69822539"},"html":{"href":"https://github.com/Codeception/Codeception/pull/3320#discussion_r69822539"},"pull_request":{"href":"https://api.github.com/repos/Codeception/Codeception/pulls/3320"}}},"pull_request":{"url":"https://api.github.com/repos/Codeception/Codeception/pulls/3320","id":76512049,"html_url":"https://github.com/Codeception/Codeception/pull/3320","diff_url":"https://github.com/Codeception/Codeception/pull/3320.diff","patch_url":"https://github.com/Codeception/Codeception/pull/3320.patch","issue_url":"https://api.github.com/repos/Codeception/Codeception/issues/3320","number":3320,"state":"open","locked":false,"title":"[REST] Display better diff output in seeResponseContainsJson","user":{"login":"Naktibalda","id":395992,"avatar_url":"https://avatars.githubusercontent.com/u/395992?v=3","gravatar_id":"","url":"https://api.github.com/users/Naktibalda","html_url":"https://github.com/Naktibalda","followers_url":"https://api.github.com/users/Naktibalda/followers","following_url":"https://api.github.com/users/Naktibalda/following{/other_user}","gists_url":"https://api.github.com/users/Naktibalda/gists{/gist_id}","starred_url":"https://api.github.com/users/Naktibalda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Naktibalda/subscriptions","organizations_url":"https://api.github.com/users/Naktibalda/orgs","repos_url":"https://api.github.com/users/Naktibalda/repos","events_url":"https://api.github.com/users/Naktibalda/events{/privacy}","received_events_url":"https://api.github.com/users/Naktibalda/received_events","type":"User","site_admin":false},"body":"I tested this change by removing size field from response.\r\n\r\nBefore:\r\n\r\n```\r\n1) PostMethodFileUploadCept: Upload file\r\n Test  tests/functional/REST/PostMethodFileUploadCept.php\r\n Step  See response contains json {\"files\":{\"dump\":{\"name\":\"dump.sql\",\"size\":57}}}\r\n Fail  Response JSON does not contain the provided JSON\r\n- array (\r\n  'files' =>\r\n  array (\r\n    'dump' =>\r\n    array (\r\n      'name' => 'dump.sql',\r\n      'size' => 57,\r\n    ),\r\n  ),\r\n)\r\n+ array (\r\n  'requestMethod' => 'POST',\r\n  'requestUri' => '/rest',\r\n  'queryParams' =>\r\n  array (\r\n  ),\r\n  'formParams' =>\r\n  array (\r\n  ),\r\n  'rawBody' => '',\r\n  'headers' =>\r\n  array (\r\n    'User-Agent' =>\r\n    array (\r\n      0 => 'Symfony2 BrowserKit',\r\n    ),\r\n    'Host' =>\r\n    array (\r\n      0 => 'localhost',\r\n    ),\r\n  ),\r\n  'X-Auth-Token' => NULL,\r\n  'files' =>\r\n  array (\r\n    'dump' =>\r\n    array (\r\n      'name' => 'dump.sql',\r\n      'tmp_name' => '/home/gintas/workspace/codeception-zend-expressive-tests/tests/_data/dump.sql',\r\n      'type' => 'text/plain',\r\n      'error' => 0,\r\n    ),\r\n  ),\r\n)\r\nFailed asserting that false is true.\r\n```\r\n\r\nAfter:\r\n```\r\n1) PostMethodFileUploadCept: Upload file\r\n Test  tests/functional/REST/PostMethodFileUploadCept.php\r\n Step  See response contains json {\"files\":{\"dump\":{\"name\":\"dump.sql\",\"size\":57}}}\r\n Fail  Failed asserting that two arrays are equal.\r\n- Expected | + Actual\r\n@@ @@\r\nArray (\r\n'files' => Array (\r\n'dump' => Array (\r\n'name' => 'dump.sql'\r\n-            'size' => 57\r\n+            'tmp_name' => '/home/gintas/workspace/codece...mp.sql'\r\n+            'type' => 'text/plain'\r\n+            'error' => 0\r\n)\r\n)\r\n+    'requestMethod' => 'POST'\r\n+    'requestUri' => '/rest'\r\n+    'queryParams' => Array ()\r\n+    'formParams' => Array ()\r\n+    'rawBody' => ''\r\n+    'headers' => Array (...)\r\n+    'X-Auth-Token' => null\r\n)\r\n```","created_at":"2016-07-06T22:23:31Z","updated_at":"2016-07-06T22:23:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"134cde0e8ea0e410ad035d4222ceff75d8ac7003","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Codeception/Codeception/pulls/3320/commits","review_comments_url":"https://api.github.com/repos/Codeception/Codeception/pulls/3320/comments","review_comment_url":"https://api.github.com/repos/Codeception/Codeception/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Codeception/Codeception/issues/3320/comments","statuses_url":"https://api.github.com/repos/Codeception/Codeception/statuses/1e4df8ce92d142b123b6072d2afebd84d036f078","head":{"label":"Naktibalda:2.2-rest-contains-better-diff","ref":"2.2-rest-contains-better-diff","sha":"1e4df8ce92d142b123b6072d2afebd84d036f078","user":{"login":"Naktibalda","id":395992,"avatar_url":"https://avatars.githubusercontent.com/u/395992?v=3","gravatar_id":"","url":"https://api.github.com/users/Naktibalda","html_url":"https://github.com/Naktibalda","followers_url":"https://api.github.com/users/Naktibalda/followers","following_url":"https://api.github.com/users/Naktibalda/following{/other_user}","gists_url":"https://api.github.com/users/Naktibalda/gists{/gist_id}","starred_url":"https://api.github.com/users/Naktibalda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Naktibalda/subscriptions","organizations_url":"https://api.github.com/users/Naktibalda/orgs","repos_url":"https://api.github.com/users/Naktibalda/repos","events_url":"https://api.github.com/users/Naktibalda/events{/privacy}","received_events_url":"https://api.github.com/users/Naktibalda/received_events","type":"User","site_admin":false},"repo":{"id":35227251,"name":"Codeception","full_name":"Naktibalda/Codeception","owner":{"login":"Naktibalda","id":395992,"avatar_url":"https://avatars.githubusercontent.com/u/395992?v=3","gravatar_id":"","url":"https://api.github.com/users/Naktibalda","html_url":"https://github.com/Naktibalda","followers_url":"https://api.github.com/users/Naktibalda/followers","following_url":"https://api.github.com/users/Naktibalda/following{/other_user}","gists_url":"https://api.github.com/users/Naktibalda/gists{/gist_id}","starred_url":"https://api.github.com/users/Naktibalda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Naktibalda/subscriptions","organizations_url":"https://api.github.com/users/Naktibalda/orgs","repos_url":"https://api.github.com/users/Naktibalda/repos","events_url":"https://api.github.com/users/Naktibalda/events{/privacy}","received_events_url":"https://api.github.com/users/Naktibalda/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Naktibalda/Codeception","description":"Full-stack testing PHP framework","fork":true,"url":"https://api.github.com/repos/Naktibalda/Codeception","forks_url":"https://api.github.com/repos/Naktibalda/Codeception/forks","keys_url":"https://api.github.com/repos/Naktibalda/Codeception/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Naktibalda/Codeception/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Naktibalda/Codeception/teams","hooks_url":"https://api.github.com/repos/Naktibalda/Codeception/hooks","issue_events_url":"https://api.github.com/repos/Naktibalda/Codeception/issues/events{/number}","events_url":"https://api.github.com/repos/Naktibalda/Codeception/events","assignees_url":"https://api.github.com/repos/Naktibalda/Codeception/assignees{/user}","branches_url":"https://api.github.com/repos/Naktibalda/Codeception/branches{/branch}","tags_url":"https://api.github.com/repos/Naktibalda/Codeception/tags","blobs_url":"https://api.github.com/repos/Naktibalda/Codeception/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Naktibalda/Codeception/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Naktibalda/Codeception/git/refs{/sha}","trees_url":"https://api.github.com/repos/Naktibalda/Codeception/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Naktibalda/Codeception/statuses/{sha}","languages_url":"https://api.github.com/repos/Naktibalda/Codeception/languages","stargazers_url":"https://api.github.com/repos/Naktibalda/Codeception/stargazers","contributors_url":"https://api.github.com/repos/Naktibalda/Codeception/contributors","subscribers_url":"https://api.github.com/repos/Naktibalda/Codeception/subscribers","subscription_url":"https://api.github.com/repos/Naktibalda/Codeception/subscription","commits_url":"https://api.github.com/repos/Naktibalda/Codeception/commits{/sha}","git_commits_url":"https://api.github.com/repos/Naktibalda/Codeception/git/commits{/sha}","comments_url":"https://api.github.com/repos/Naktibalda/Codeception/comments{/number}","issue_comment_url":"https://api.github.com/repos/Naktibalda/Codeception/issues/comments{/number}","contents_url":"https://api.github.com/repos/Naktibalda/Codeception/contents/{+path}","compare_url":"https://api.github.com/repos/Naktibalda/Codeception/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Naktibalda/Codeception/merges","archive_url":"https://api.github.com/repos/Naktibalda/Codeception/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Naktibalda/Codeception/downloads","issues_url":"https://api.github.com/repos/Naktibalda/Codeception/issues{/number}","pulls_url":"https://api.github.com/repos/Naktibalda/Codeception/pulls{/number}","milestones_url":"https://api.github.com/repos/Naktibalda/Codeception/milestones{/number}","notifications_url":"https://api.github.com/repos/Naktibalda/Codeception/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Naktibalda/Codeception/labels{/name}","releases_url":"https://api.github.com/repos/Naktibalda/Codeception/releases{/id}","deployments_url":"https://api.github.com/repos/Naktibalda/Codeception/deployments","created_at":"2015-05-07T15:14:58Z","updated_at":"2016-02-11T21:39:48Z","pushed_at":"2016-07-06T22:22:09Z","git_url":"git://github.com/Naktibalda/Codeception.git","ssh_url":"git@github.com:Naktibalda/Codeception.git","clone_url":"https://github.com/Naktibalda/Codeception.git","svn_url":"https://github.com/Naktibalda/Codeception","homepage":"http://codeception.com","size":64530,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"2.1"}},"base":{"label":"Codeception:2.2","ref":"2.2","sha":"76c2d8a74b81823ff238a85b88ffd7406d5be7ca","user":{"login":"Codeception","id":1288753,"avatar_url":"https://avatars.githubusercontent.com/u/1288753?v=3","gravatar_id":"","url":"https://api.github.com/users/Codeception","html_url":"https://github.com/Codeception","followers_url":"https://api.github.com/users/Codeception/followers","following_url":"https://api.github.com/users/Codeception/following{/other_user}","gists_url":"https://api.github.com/users/Codeception/gists{/gist_id}","starred_url":"https://api.github.com/users/Codeception/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Codeception/subscriptions","organizations_url":"https://api.github.com/users/Codeception/orgs","repos_url":"https://api.github.com/users/Codeception/repos","events_url":"https://api.github.com/users/Codeception/events{/privacy}","received_events_url":"https://api.github.com/users/Codeception/received_events","type":"Organization","site_admin":false},"repo":{"id":2880469,"name":"Codeception","full_name":"Codeception/Codeception","owner":{"login":"Codeception","id":1288753,"avatar_url":"https://avatars.githubusercontent.com/u/1288753?v=3","gravatar_id":"","url":"https://api.github.com/users/Codeception","html_url":"https://github.com/Codeception","followers_url":"https://api.github.com/users/Codeception/followers","following_url":"https://api.github.com/users/Codeception/following{/other_user}","gists_url":"https://api.github.com/users/Codeception/gists{/gist_id}","starred_url":"https://api.github.com/users/Codeception/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Codeception/subscriptions","organizations_url":"https://api.github.com/users/Codeception/orgs","repos_url":"https://api.github.com/users/Codeception/repos","events_url":"https://api.github.com/users/Codeception/events{/privacy}","received_events_url":"https://api.github.com/users/Codeception/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Codeception/Codeception","description":"Full-stack testing PHP framework","fork":false,"url":"https://api.github.com/repos/Codeception/Codeception","forks_url":"https://api.github.com/repos/Codeception/Codeception/forks","keys_url":"https://api.github.com/repos/Codeception/Codeception/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Codeception/Codeception/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Codeception/Codeception/teams","hooks_url":"https://api.github.com/repos/Codeception/Codeception/hooks","issue_events_url":"https://api.github.com/repos/Codeception/Codeception/issues/events{/number}","events_url":"https://api.github.com/repos/Codeception/Codeception/events","assignees_url":"https://api.github.com/repos/Codeception/Codeception/assignees{/user}","branches_url":"https://api.github.com/repos/Codeception/Codeception/branches{/branch}","tags_url":"https://api.github.com/repos/Codeception/Codeception/tags","blobs_url":"https://api.github.com/repos/Codeception/Codeception/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Codeception/Codeception/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Codeception/Codeception/git/refs{/sha}","trees_url":"https://api.github.com/repos/Codeception/Codeception/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Codeception/Codeception/statuses/{sha}","languages_url":"https://api.github.com/repos/Codeception/Codeception/languages","stargazers_url":"https://api.github.com/repos/Codeception/Codeception/stargazers","contributors_url":"https://api.github.com/repos/Codeception/Codeception/contributors","subscribers_url":"https://api.github.com/repos/Codeception/Codeception/subscribers","subscription_url":"https://api.github.com/repos/Codeception/Codeception/subscription","commits_url":"https://api.github.com/repos/Codeception/Codeception/commits{/sha}","git_commits_url":"https://api.github.com/repos/Codeception/Codeception/git/commits{/sha}","comments_url":"https://api.github.com/repos/Codeception/Codeception/comments{/number}","issue_comment_url":"https://api.github.com/repos/Codeception/Codeception/issues/comments{/number}","contents_url":"https://api.github.com/repos/Codeception/Codeception/contents/{+path}","compare_url":"https://api.github.com/repos/Codeception/Codeception/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Codeception/Codeception/merges","archive_url":"https://api.github.com/repos/Codeception/Codeception/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Codeception/Codeception/downloads","issues_url":"https://api.github.com/repos/Codeception/Codeception/issues{/number}","pulls_url":"https://api.github.com/repos/Codeception/Codeception/pulls{/number}","milestones_url":"https://api.github.com/repos/Codeception/Codeception/milestones{/number}","notifications_url":"https://api.github.com/repos/Codeception/Codeception/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Codeception/Codeception/labels{/name}","releases_url":"https://api.github.com/repos/Codeception/Codeception/releases{/id}","deployments_url":"https://api.github.com/repos/Codeception/Codeception/deployments","created_at":"2011-11-30T04:06:44Z","updated_at":"2016-07-05T21:08:20Z","pushed_at":"2016-07-06T22:23:32Z","git_url":"git://github.com/Codeception/Codeception.git","ssh_url":"git@github.com:Codeception/Codeception.git","clone_url":"https://github.com/Codeception/Codeception.git","svn_url":"https://github.com/Codeception/Codeception","homepage":"http://codeception.com","size":74728,"stargazers_count":2257,"watchers_count":2257,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":832,"mirror_url":null,"open_issues_count":271,"forks":832,"open_issues":271,"watchers":2257,"default_branch":"2.2"}},"_links":{"self":{"href":"https://api.github.com/repos/Codeception/Codeception/pulls/3320"},"html":{"href":"https://github.com/Codeception/Codeception/pull/3320"},"issue":{"href":"https://api.github.com/repos/Codeception/Codeception/issues/3320"},"comments":{"href":"https://api.github.com/repos/Codeception/Codeception/issues/3320/comments"},"review_comments":{"href":"https://api.github.com/repos/Codeception/Codeception/pulls/3320/comments"},"review_comment":{"href":"https://api.github.com/repos/Codeception/Codeception/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Codeception/Codeception/pulls/3320/commits"},"statuses":{"href":"https://api.github.com/repos/Codeception/Codeception/statuses/1e4df8ce92d142b123b6072d2afebd84d036f078"}}}}
{"actor":{"display_login":"Nitpick-CI"}}