GitHub PullRequestReviewCommentEvent at 2014-02-04 18:52:00
Repository: endofcodes
Actor: VitSalis
Payload: {"comment":{"url":"https://api.github.com/repos/dionyziz/endofcodes/pulls/comments/9432936","id":9432936,"diff_hunk":"@@ -0,0 +1,56 @@\n+<?php\n+    include_once 'models/country.php';\n+    \n+    class CountryTest extends UnitTest {\n+        protected $countries = array(\n+            'GR' => 'Greece',\n+            'UK' => 'England',\n+            'RU' => 'Russia'\n+        );\n+        \n+        protected function insertCountries() {\n+            $countries = $this->countries;\n+            foreach ( $countries as $shortname => $name ) {\n+                $country = new Country();\n+                $country->shortname = $shortname;\n+                $country->name = $name;\n+                $country->save();\n+            }\n+        }\n+        public function testInsertCountries() {\n+            $this->insertCountries();\n+            $countries = Country::findAll();\n+            $this->assertTrue( !empty( $countries ), \"'insertCountries()' did not insert countries in the db\" );\n+        }\n+        public function testFindNonExistentCountry() {\n+            $caught = false;\n+            try {\n+                $country = new Country( 1 );\n+            }\n+            catch ( ModelNotFoundException $e ) {\n+                $caught = true;\n+            }\n+            $this->assertTrue( $caught, 'When we try to find a non existent country we must get a ModelNotFoundException' );\n+        }\n+        public function testFindAll() {\n+            $this->insertCountries();\n+            $countriesArray = Country::findAll(); \n+            $this->assertTrue( is_array( $countriesArray ), 'Country::findAll() did not return an array of countries' );\n+            $this->assertTrue( count( $countriesArray ) == 3, 'Country::findAll() did not return as many countries as it should' );\n+        } \n+        public function testCountryConstruct() {\n+            $countries = $this->countries;\n+            $testId = 1;\n+            $shortnames = array_keys( $countries );\n+            $shortname = $shortnames[ 0 ];\n+            $this->insertCountries();\n+            $country = new Country( $testId );\n+            $this->assertTrue( is_object( $country ), \"'new Country()' did not return an object\" );\n+            $this->assertEquals( $testId, $country->id, \"'new Country()' did not return the appropriate country\" );\n+            $this->assertEquals( $country->shortname, $shortname, \"'new Country()' did not return the appropriate shortname\" );\n+            $this->assertEquals( $country->name, $countries[ $shortname ], \"'new Country()' did not return the appropriate name\" );","path":"tests/models/country.php","position":51,"original_position":51,"commit_id":"2abb6e6904f6bc80991035b9838fd0992789cd36","original_commit_id":"2abb6e6904f6bc80991035b9838fd0992789cd36","user":{"login":"VitSalis","id":1957592,"avatar_url":"https://gravatar.com/avatar/8ae1e5b3c4d1df49c17ebefcc25f9dc2?d=https%3A%2F%2Fidenticons.github.com%2Ff20394f1d7664b1019b4435467394a2b.png&r=x","gravatar_id":"8ae1e5b3c4d1df49c17ebefcc25f9dc2","url":"https://api.github.com/users/VitSalis","html_url":"https://github.com/VitSalis","followers_url":"https://api.github.com/users/VitSalis/followers","following_url":"https://api.github.com/users/VitSalis/following{/other_user}","gists_url":"https://api.github.com/users/VitSalis/gists{/gist_id}","starred_url":"https://api.github.com/users/VitSalis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VitSalis/subscriptions","organizations_url":"https://api.github.com/users/VitSalis/orgs","repos_url":"https://api.github.com/users/VitSalis/repos","events_url":"https://api.github.com/users/VitSalis/events{/privacy}","received_events_url":"https://api.github.com/users/VitSalis/received_events","type":"User","site_admin":false},"body":"expected first, then actual","created_at":"2014-02-04T18:52:00Z","updated_at":"2014-02-04T18:52:00Z","html_url":"https://github.com/dionyziz/endofcodes/pull/25#discussion_r9432936","pull_request_url":"https://api.github.com/repos/dionyziz/endofcodes/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/dionyziz/endofcodes/pulls/comments/9432936"},"html":{"href":"https://github.com/dionyziz/endofcodes/pull/25#discussion_r9432936"},"pull_request":{"href":"https://api.github.com/repos/dionyziz/endofcodes/pulls/25"}}}}