{"action":"created","comment":{"url":"https://api.github.com/repos/narrowspark/framework/pulls/comments/77090990","id":77090990,"diff_hunk":"@@ -195,142 +280,218 @@ public function testExtendCanBeCalledBeforeBind()\n             return $old . 'bar';\n         });\n         $container['foo'] = 'foo';\n+\n         $this->assertEquals('foobar', $container->make('foo'));\n     }\n \n     public function testParametersCanBePassedThroughToClosure()\n     {\n         $container = $this->container;\n-        $container->bind('foo', function ($c, $parameters) {\n-            return $parameters;\n+        $container->bind('foo', function ($container, $a, $b, $c) {\n+            return [$a, $b, $c];\n         });\n+\n         $this->assertEquals([1, 2, 3], $container->make('foo', [1, 2, 3]));\n     }\n \n-    public function testCallWithDependencies()\n+    public function testResolutionOfDefaultParameters()\n     {\n-        $container = $this->container;\n-        $result = $container->call(function (\\StdClass $foo, $bar = []) {\n-            return func_get_args();\n-        });\n-        $this->assertInstanceOf('stdClass', $result[0]);\n-        $this->assertEquals([], $result[1]);\n-        $result = $container->call(function (\\StdClass $foo, $bar = []) {\n-            return func_get_args();\n-        }, ['bar' => 'taylor']);\n-        $this->assertInstanceOf('stdClass', $result[0]);\n-        $this->assertEquals('taylor', $result[1]);\n-        /*\n-         * Wrap a function...\n-         */\n-        $result = $container->wrap(function (\\StdClass $foo, $bar = []) {\n-            return func_get_args();\n-        }, ['bar' => 'taylor']);\n-        $this->assertInstanceOf('Closure', $result);\n-        $result = $result();\n-        $this->assertInstanceOf('stdClass', $result[0]);\n-        $this->assertEquals('taylor', $result[1]);\n+        $container = new Container();\n+        $instance = $container->make(ContainerDefaultValueFixture::class);\n+\n+        $this->assertInstanceOf(ContainerConcreteFixture::class, $instance->stub);\n+        $this->assertEquals('narrowspark', $instance->default);\n     }\n \n+    public function testUnsetRemoveBoundInstances()\n+    {\n+        $container = new Container();\n+        $container->instance('object', new StdClass());\n+        unset($container['object']);\n+\n+        $this->assertFalse($container->has('object'));\n+\n+        $container->instance('object', new StdClass());\n+        $container->forget('object');\n+\n+        $this->assertFalse($container->has('object'));\n+    }\n+\n+    public function testBoundInstanceAndAliasCheckViaArrayAccess()\n+    {\n+        $container = new Container();\n+        $container->instance('object', new StdClass());\n+        $container->alias('object', 'alias');\n+\n+        $this->assertTrue(isset($container['object']));\n+        $this->assertTrue(isset($container['alias']));\n+    }\n+\n+    /**\n+     * @expectedException \\Viserio\\Contracts\\Container\\Exceptions\\CircularReferenceException\n+     * @expectedExceptionMessage Circular reference found while resolving [Viserio\\Container\\Tests\\Fixture\\ContainerCircularReferenceStubD].\n+     */\n     public function testCircularReferenceCheck()\n     {\n         // Since the dependency is ( D -> F -> E -> D ), the exception\n         // message should state that the issue starts in class D\n-        $this->setExpectedException('Viserio\\Container\\CircularReferenceException', 'Circular reference found while resolving [ContainerCircularReferenceStubD].');\n         $container = $this->container;\n-        $parameters = [];\n-        $container->make('ContainerCircularReferenceStubD', $parameters);\n+        $container->make(ContainerCircularReferenceStubD::class);\n     }\n \n+    /**\n+     * @expectedException \\Viserio\\Contracts\\Container\\Exceptions\\CircularReferenceException\n+     * @expectedExceptionMessage Circular reference found while resolving [Viserio\\Container\\Tests\\Fixture\\ContainerCircularReferenceStubB].\n+     */\n     public function testCircularReferenceCheckDetectCycleStartLocation()\n     {\n         // Since the dependency is ( A -> B -> C -> B ), the exception\n         // message should state that the issue starts in class B\n-        $this->setExpectedException('Viserio\\Container\\CircularReferenceException', 'Circular reference found while resolving [ContainerCircularReferenceStubB].');\n         $container = $this->container;\n-        $parameters = [];\n-        $container->make('ContainerCircularReferenceStubA', $parameters);\n+        $container->make(ContainerCircularReferenceStubA::class);\n     }\n \n-    /**\n-     * Methods should using contextual binding\n-     */\n-    public function testContextualBindingOnMethods()\n+    public function testContainerCanInjectSimpleVariable()\n     {\n         $container = new Container();\n-        $container->when('ContainerTestInterfaceStub')->needs('IContainerContractStub')->give('ContainerImplementationStub');\n+        $container->when(ContainerInjectVariableFixture::class)\n+            ->needs('$something')\n+            ->give(100);\n+        $instance = $container->make(ContainerInjectVariableFixture::class);\n \n-         // Works if using constructor\n-        $constructor = $container->make('ContainerTestInterfaceStub');\n-        $result = $constructor->getStub();\n-        $this->assertInstanceOf('ContainerImplementationStub', $result);\n+        $this->assertEquals(100, $instance->something);\n \n-         // Doesn't work if using methods\n-        $result = $container->call('ContainerTestInterfaceStub@go');\n-        $this->assertInstanceOf('ContainerImplementationStub', $result);\n-    }\n-}\n+        $container = new Container;\n+        $container->when(ContainerInjectVariableFixture::class)\n+            ->needs('$something')->give(function ($container) {\n+                return $container->make(ContainerConcreteFixture::class);\n+            });\n \n-class ContainerConcreteStub\n-{\n-}\n+        $instance = $container->make(ContainerInjectVariableFixture::class);\n \n-class ContainerCircularReferenceStubA\n-{\n-    public function __construct(ContainerCircularReferenceStubB $b)\n-    {\n+        $this->assertInstanceOf(ContainerConcreteFixture::class, $instance->something);\n     }\n-}\n \n-class ContainerCircularReferenceStubB\n-{\n-    public function __construct(ContainerCircularReferenceStubC $c)\n+    public function testContainerCanInjectDifferentImplementationsDependingOnContext()\n     {\n-    }\n-}\n+        $container = new Container();\n+        $container->bind(ContainerContractFixtureInterface::class, ContainerImplementationFixture::class);\n \n-class ContainerCircularReferenceStubC\n-{\n-    public function __construct(ContainerCircularReferenceStubB $b)\n-    {\n-    }\n-}\n+        $container->when(ContainerTestContextInjectOneFixture::class)\n+            ->needs(ContainerContractFixtureInterface::class)\n+            ->give(ContainerImplementationFixture::class);\n \n-class ContainerCircularReferenceStubD\n-{\n-    public function __construct(ContainerCircularReferenceStubE $e)\n-    {\n+        $container->when(ContainerTestContextInjectTwoFixture::class)\n+            ->needs(ContainerContractFixtureInterface::class)\n+            ->give(ContainerImplementationTwoFixture::class);\n+\n+        $one = $container->make(ContainerTestContextInjectOneFixture::class);\n+        $two = $container->make(ContainerTestContextInjectTwoFixture::class);\n+\n+        $this->assertInstanceOf(ContainerImplementationFixture::class, $one->impl);\n+        $this->assertInstanceOf(ContainerImplementationTwoFixture::class, $two->impl);\n+\n+        /*\n+         * Test With Closures\n+         */\n+        $container = new Container();\n+        $container->bind(ContainerContractFixtureInterface::class, ContainerImplementationFixture::class);\n+        $container->when(ContainerTestContextInjectOneFixture::class)\n+            ->needs(ContainerContractFixtureInterface::class)\n+            ->give(ContainerImplementationFixture::class);\n+        $container->when(ContainerTestContextInjectTwoFixture::class)\n+            ->needs(ContainerContractFixtureInterface::class)\n+            ->give(function ($container) {\n+            return $container->make(ContainerImplementationTwoFixture::class);\n+        });","path":"src/Viserio/Container/Tests/ContainerTest.php","position":null,"original_position":464,"commit_id":"c7372176976dd10803be880ee92014c06e7f656c","original_commit_id":"c142b115a22dbede72c179679c0b30d5f267b5d6","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":"- Line indented incorrectly; expected 12 spaces, found 8\n- Closing brace indented incorrectly; expected 12 spaces, found 8\n","created_at":"2016-08-31T23:17:36Z","updated_at":"2016-08-31T23:17:36Z","html_url":"https://github.com/narrowspark/framework/pull/358#discussion_r77090990","pull_request_url":"https://api.github.com/repos/narrowspark/framework/pulls/358","_links":{"self":{"href":"https://api.github.com/repos/narrowspark/framework/pulls/comments/77090990"},"html":{"href":"https://github.com/narrowspark/framework/pull/358#discussion_r77090990"},"pull_request":{"href":"https://api.github.com/repos/narrowspark/framework/pulls/358"}}},"pull_request":{"url":"https://api.github.com/repos/narrowspark/framework/pulls/358","id":83326440,"html_url":"https://github.com/narrowspark/framework/pull/358","diff_url":"https://github.com/narrowspark/framework/pull/358.diff","patch_url":"https://github.com/narrowspark/framework/pull/358.patch","issue_url":"https://api.github.com/repos/narrowspark/framework/issues/358","number":358,"state":"open","locked":false,"title":"Issue 43 refactor container V2","user":{"login":"prisis","id":2716058,"avatar_url":"https://avatars.githubusercontent.com/u/2716058?v=3","gravatar_id":"","url":"https://api.github.com/users/prisis","html_url":"https://github.com/prisis","followers_url":"https://api.github.com/users/prisis/followers","following_url":"https://api.github.com/users/prisis/following{/other_user}","gists_url":"https://api.github.com/users/prisis/gists{/gist_id}","starred_url":"https://api.github.com/users/prisis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prisis/subscriptions","organizations_url":"https://api.github.com/users/prisis/orgs","repos_url":"https://api.github.com/users/prisis/repos","events_url":"https://api.github.com/users/prisis/events{/privacy}","received_events_url":"https://api.github.com/users/prisis/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-30T18:53:07Z","updated_at":"2016-08-31T23:17:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d67302d3957a86c73ba8031841a114992a8f285","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/narrowspark/framework/pulls/358/commits","review_comments_url":"https://api.github.com/repos/narrowspark/framework/pulls/358/comments","review_comment_url":"https://api.github.com/repos/narrowspark/framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/narrowspark/framework/issues/358/comments","statuses_url":"https://api.github.com/repos/narrowspark/framework/statuses/c7372176976dd10803be880ee92014c06e7f656c","head":{"label":"narrowspark:issue-43-refactor-container","ref":"issue-43-refactor-container","sha":"c7372176976dd10803be880ee92014c06e7f656c","user":{"login":"narrowspark","id":7030108,"avatar_url":"https://avatars.githubusercontent.com/u/7030108?v=3","gravatar_id":"","url":"https://api.github.com/users/narrowspark","html_url":"https://github.com/narrowspark","followers_url":"https://api.github.com/users/narrowspark/followers","following_url":"https://api.github.com/users/narrowspark/following{/other_user}","gists_url":"https://api.github.com/users/narrowspark/gists{/gist_id}","starred_url":"https://api.github.com/users/narrowspark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narrowspark/subscriptions","organizations_url":"https://api.github.com/users/narrowspark/orgs","repos_url":"https://api.github.com/users/narrowspark/repos","events_url":"https://api.github.com/users/narrowspark/events{/privacy}","received_events_url":"https://api.github.com/users/narrowspark/received_events","type":"Organization","site_admin":false},"repo":{"id":35821465,"name":"framework","full_name":"narrowspark/framework","owner":{"login":"narrowspark","id":7030108,"avatar_url":"https://avatars.githubusercontent.com/u/7030108?v=3","gravatar_id":"","url":"https://api.github.com/users/narrowspark","html_url":"https://github.com/narrowspark","followers_url":"https://api.github.com/users/narrowspark/followers","following_url":"https://api.github.com/users/narrowspark/following{/other_user}","gists_url":"https://api.github.com/users/narrowspark/gists{/gist_id}","starred_url":"https://api.github.com/users/narrowspark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narrowspark/subscriptions","organizations_url":"https://api.github.com/users/narrowspark/orgs","repos_url":"https://api.github.com/users/narrowspark/repos","events_url":"https://api.github.com/users/narrowspark/events{/privacy}","received_events_url":"https://api.github.com/users/narrowspark/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/narrowspark/framework","description":":space_invader: Narrowspark Framework.","fork":false,"url":"https://api.github.com/repos/narrowspark/framework","forks_url":"https://api.github.com/repos/narrowspark/framework/forks","keys_url":"https://api.github.com/repos/narrowspark/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/narrowspark/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/narrowspark/framework/teams","hooks_url":"https://api.github.com/repos/narrowspark/framework/hooks","issue_events_url":"https://api.github.com/repos/narrowspark/framework/issues/events{/number}","events_url":"https://api.github.com/repos/narrowspark/framework/events","assignees_url":"https://api.github.com/repos/narrowspark/framework/assignees{/user}","branches_url":"https://api.github.com/repos/narrowspark/framework/branches{/branch}","tags_url":"https://api.github.com/repos/narrowspark/framework/tags","blobs_url":"https://api.github.com/repos/narrowspark/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/narrowspark/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/narrowspark/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/narrowspark/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/narrowspark/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/narrowspark/framework/languages","stargazers_url":"https://api.github.com/repos/narrowspark/framework/stargazers","contributors_url":"https://api.github.com/repos/narrowspark/framework/contributors","subscribers_url":"https://api.github.com/repos/narrowspark/framework/subscribers","subscription_url":"https://api.github.com/repos/narrowspark/framework/subscription","commits_url":"https://api.github.com/repos/narrowspark/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/narrowspark/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/narrowspark/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/narrowspark/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/narrowspark/framework/contents/{+path}","compare_url":"https://api.github.com/repos/narrowspark/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/narrowspark/framework/merges","archive_url":"https://api.github.com/repos/narrowspark/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/narrowspark/framework/downloads","issues_url":"https://api.github.com/repos/narrowspark/framework/issues{/number}","pulls_url":"https://api.github.com/repos/narrowspark/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/narrowspark/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/narrowspark/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/narrowspark/framework/labels{/name}","releases_url":"https://api.github.com/repos/narrowspark/framework/releases{/id}","deployments_url":"https://api.github.com/repos/narrowspark/framework/deployments","created_at":"2015-05-18T14:06:11Z","updated_at":"2016-01-11T13:05:37Z","pushed_at":"2016-08-31T23:17:29Z","git_url":"git://github.com/narrowspark/framework.git","ssh_url":"git@github.com:narrowspark/framework.git","clone_url":"https://github.com/narrowspark/framework.git","svn_url":"https://github.com/narrowspark/framework","homepage":"","size":3742,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":45,"forks":1,"open_issues":45,"watchers":0,"default_branch":"develop"}},"base":{"label":"narrowspark:develop","ref":"develop","sha":"5553dbd07b675092adecec6365727dc279dfd3b3","user":{"login":"narrowspark","id":7030108,"avatar_url":"https://avatars.githubusercontent.com/u/7030108?v=3","gravatar_id":"","url":"https://api.github.com/users/narrowspark","html_url":"https://github.com/narrowspark","followers_url":"https://api.github.com/users/narrowspark/followers","following_url":"https://api.github.com/users/narrowspark/following{/other_user}","gists_url":"https://api.github.com/users/narrowspark/gists{/gist_id}","starred_url":"https://api.github.com/users/narrowspark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narrowspark/subscriptions","organizations_url":"https://api.github.com/users/narrowspark/orgs","repos_url":"https://api.github.com/users/narrowspark/repos","events_url":"https://api.github.com/users/narrowspark/events{/privacy}","received_events_url":"https://api.github.com/users/narrowspark/received_events","type":"Organization","site_admin":false},"repo":{"id":35821465,"name":"framework","full_name":"narrowspark/framework","owner":{"login":"narrowspark","id":7030108,"avatar_url":"https://avatars.githubusercontent.com/u/7030108?v=3","gravatar_id":"","url":"https://api.github.com/users/narrowspark","html_url":"https://github.com/narrowspark","followers_url":"https://api.github.com/users/narrowspark/followers","following_url":"https://api.github.com/users/narrowspark/following{/other_user}","gists_url":"https://api.github.com/users/narrowspark/gists{/gist_id}","starred_url":"https://api.github.com/users/narrowspark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narrowspark/subscriptions","organizations_url":"https://api.github.com/users/narrowspark/orgs","repos_url":"https://api.github.com/users/narrowspark/repos","events_url":"https://api.github.com/users/narrowspark/events{/privacy}","received_events_url":"https://api.github.com/users/narrowspark/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/narrowspark/framework","description":":space_invader: Narrowspark Framework.","fork":false,"url":"https://api.github.com/repos/narrowspark/framework","forks_url":"https://api.github.com/repos/narrowspark/framework/forks","keys_url":"https://api.github.com/repos/narrowspark/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/narrowspark/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/narrowspark/framework/teams","hooks_url":"https://api.github.com/repos/narrowspark/framework/hooks","issue_events_url":"https://api.github.com/repos/narrowspark/framework/issues/events{/number}","events_url":"https://api.github.com/repos/narrowspark/framework/events","assignees_url":"https://api.github.com/repos/narrowspark/framework/assignees{/user}","branches_url":"https://api.github.com/repos/narrowspark/framework/branches{/branch}","tags_url":"https://api.github.com/repos/narrowspark/framework/tags","blobs_url":"https://api.github.com/repos/narrowspark/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/narrowspark/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/narrowspark/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/narrowspark/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/narrowspark/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/narrowspark/framework/languages","stargazers_url":"https://api.github.com/repos/narrowspark/framework/stargazers","contributors_url":"https://api.github.com/repos/narrowspark/framework/contributors","subscribers_url":"https://api.github.com/repos/narrowspark/framework/subscribers","subscription_url":"https://api.github.com/repos/narrowspark/framework/subscription","commits_url":"https://api.github.com/repos/narrowspark/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/narrowspark/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/narrowspark/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/narrowspark/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/narrowspark/framework/contents/{+path}","compare_url":"https://api.github.com/repos/narrowspark/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/narrowspark/framework/merges","archive_url":"https://api.github.com/repos/narrowspark/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/narrowspark/framework/downloads","issues_url":"https://api.github.com/repos/narrowspark/framework/issues{/number}","pulls_url":"https://api.github.com/repos/narrowspark/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/narrowspark/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/narrowspark/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/narrowspark/framework/labels{/name}","releases_url":"https://api.github.com/repos/narrowspark/framework/releases{/id}","deployments_url":"https://api.github.com/repos/narrowspark/framework/deployments","created_at":"2015-05-18T14:06:11Z","updated_at":"2016-01-11T13:05:37Z","pushed_at":"2016-08-31T23:17:29Z","git_url":"git://github.com/narrowspark/framework.git","ssh_url":"git@github.com:narrowspark/framework.git","clone_url":"https://github.com/narrowspark/framework.git","svn_url":"https://github.com/narrowspark/framework","homepage":"","size":3742,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":45,"forks":1,"open_issues":45,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/narrowspark/framework/pulls/358"},"html":{"href":"https://github.com/narrowspark/framework/pull/358"},"issue":{"href":"https://api.github.com/repos/narrowspark/framework/issues/358"},"comments":{"href":"https://api.github.com/repos/narrowspark/framework/issues/358/comments"},"review_comments":{"href":"https://api.github.com/repos/narrowspark/framework/pulls/358/comments"},"review_comment":{"href":"https://api.github.com/repos/narrowspark/framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/narrowspark/framework/pulls/358/commits"},"statuses":{"href":"https://api.github.com/repos/narrowspark/framework/statuses/c7372176976dd10803be880ee92014c06e7f656c"}}}}
{"actor":{"display_login":"Nitpick-CI"}}