@@ -34,8 +34,8 @@ |
||
| 34 | 34 | { |
| 35 | 35 | return [ |
| 36 | 36 | // key, value exists? |
| 37 | - [ 'No such key', null, false ], // missing key |
|
| 38 | - [ StoreTest::KEY, StoreTest::$MOST_RECENT_VALUE, true ], // present key |
|
| 37 | + ['No such key', null, false], // missing key |
|
| 38 | + [StoreTest::KEY, StoreTest::$MOST_RECENT_VALUE, true], // present key |
|
| 39 | 39 | ]; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -36,11 +36,11 @@ |
||
| 36 | 36 | public function nouns() |
| 37 | 37 | { |
| 38 | 38 | return [ |
| 39 | - ['Customer', ['Customer' ]], |
|
| 40 | - ["Customer's Car", ['Customer', 'Car' ]], |
|
| 41 | - ["8th Customer's Car", ['8th Customer', 'Car' ]], |
|
| 42 | - ["Customer's 2nd Car", ['Customer', '2nd Car' ]], |
|
| 43 | - ["7th Customer's 4th Car", ['7th Customer', '4th Car' ]], |
|
| 39 | + ['Customer', ['Customer']], |
|
| 40 | + ["Customer's Car", ['Customer', 'Car']], |
|
| 41 | + ["8th Customer's Car", ['8th Customer', 'Car']], |
|
| 42 | + ["Customer's 2nd Car", ['Customer', '2nd Car']], |
|
| 43 | + ["7th Customer's 4th Car", ['7th Customer', '4th Car']], |
|
| 44 | 44 | ["7th Customer's 4th Car's Wheel", ['7th Customer', '4th Car', 'Wheel']], |
| 45 | 45 | ]; |
| 46 | 46 | } |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | { |
| 57 | 57 | return array_reduce( |
| 58 | 58 | $this->keyService->parse($key), |
| 59 | - static function ($carry, $item) { |
|
| 59 | + static function($carry, $item) { |
|
| 60 | 60 | list($noun, $index) = $item; |
| 61 | 61 | |
| 62 | 62 | $carry = data_get($carry, $noun); |
@@ -60,15 +60,15 @@ |
||
| 60 | 60 | { |
| 61 | 61 | return [ |
| 62 | 62 | // key parsed key expected |
| 63 | - 'Noun without index returns most recent noun' => [StoreTest::KEY, [[StoreTest::KEY, null]], StoreTest::$MOST_RECENT_VALUE], |
|
| 64 | - 'Noun with index returns specific noun' => ['1st ' . StoreTest::KEY, [[StoreTest::KEY, 0]], StoreTest::$FIRST_VALUE], |
|
| 65 | - 'Non-existent noun returns null' => ['3rd ' . StoreTest::KEY, [[StoreTest::KEY, 2]], null], |
|
| 66 | - 'Possessive noun w/o index string property' => [StoreTest::KEY . "'s color", [[StoreTest::KEY, null], ['color', null]], 'Blue'], |
|
| 67 | - 'Possessive noun with index string property' => ['1st ' . StoreTest::KEY . "'s color", [[StoreTest::KEY, 0], ['color', null]], 'Red'], |
|
| 68 | - 'Possessive noun w/o index collection w/o index' => [StoreTest::KEY . "'s option", [[StoreTest::KEY, null], ['option', null]], 'Air Conditioning'], |
|
| 69 | - 'Possessive noun with index collection w/o index' => ['1st ' . StoreTest::KEY . "'s option", [[StoreTest::KEY, 0], ['option', null]], 'Heated Seats'], |
|
| 70 | - 'Possessive noun w/o index collection with index' => [StoreTest::KEY . "'s 1st option", [[StoreTest::KEY, null], ['option', 0]], 'Cruise Control'], |
|
| 71 | - 'Possessive noun with index collection with index' => ['1st ' . StoreTest::KEY . "'s 1st option", [[StoreTest::KEY, 0], ['option', 0]], 'GPS'], |
|
| 63 | + 'Noun without index returns most recent noun' => [StoreTest::KEY, [[StoreTest::KEY, null]], StoreTest::$MOST_RECENT_VALUE], |
|
| 64 | + 'Noun with index returns specific noun' => ['1st ' . StoreTest::KEY, [[StoreTest::KEY, 0]], StoreTest::$FIRST_VALUE], |
|
| 65 | + 'Non-existent noun returns null' => ['3rd ' . StoreTest::KEY, [[StoreTest::KEY, 2]], null], |
|
| 66 | + 'Possessive noun w/o index string property' => [StoreTest::KEY . "'s color", [[StoreTest::KEY, null], ['color', null]], 'Blue'], |
|
| 67 | + 'Possessive noun with index string property' => ['1st ' . StoreTest::KEY . "'s color", [[StoreTest::KEY, 0], ['color', null]], 'Red'], |
|
| 68 | + 'Possessive noun w/o index collection w/o index' => [StoreTest::KEY . "'s option", [[StoreTest::KEY, null], ['option', null]], 'Air Conditioning'], |
|
| 69 | + 'Possessive noun with index collection w/o index' => ['1st ' . StoreTest::KEY . "'s option", [[StoreTest::KEY, 0], ['option', null]], 'Heated Seats'], |
|
| 70 | + 'Possessive noun w/o index collection with index' => [StoreTest::KEY . "'s 1st option", [[StoreTest::KEY, null], ['option', 0]], 'Cruise Control'], |
|
| 71 | + 'Possessive noun with index collection with index' => ['1st ' . StoreTest::KEY . "'s 1st option", [[StoreTest::KEY, 0], ['option', 0]], 'GPS'], |
|
| 72 | 72 | ]; |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -74,15 +74,15 @@ |
||
| 74 | 74 | public function happyPathDataProvider() |
| 75 | 75 | { |
| 76 | 76 | return [ |
| 77 | - 'Noun' => ['Person', self::$alice, 'Alice is the most recent Person in the store'], |
|
| 78 | - 'Nth Noun' => ['1st Person', self::$bob, 'Bob is the 1st Person in the store'], |
|
| 79 | - 'Related Noun' => ["Person's car", self::$chevy, 'Alice is the most recent Person in the store, and her most recent car is the Chevrolet'], |
|
| 80 | - 'Related Nth Noun' => ["Person's 1st car", self::$ford, 'Alice is the most recent Person in the store, and her 1st car is the Ford'], |
|
| 81 | - 'Nth Nouns Related Noun' => ["1st Person's car", self::$toyota, 'Bob is the 1st Person in the store, and his most recent car is the Toyota'], |
|
| 82 | - 'Nth Nouns Related Nth Noun' => ["1st Person's 1st car", self::$kia, 'Bob is the 1st Person in the store, and his 1st car is the Kia'], |
|
| 83 | - 'Missing Noun' => ['Dog', null, 'Dog does not exist in the store'], |
|
| 84 | - 'Missing Nth Noun' => ['3rd Person', null, '3rd Person does not exist in the store'], |
|
| 85 | - 'Missing Related Noun' => ["Person's dog", null, 'Alice is the most recent Person in the store, but has no dog'], |
|
| 77 | + 'Noun' => ['Person', self::$alice, 'Alice is the most recent Person in the store'], |
|
| 78 | + 'Nth Noun' => ['1st Person', self::$bob, 'Bob is the 1st Person in the store'], |
|
| 79 | + 'Related Noun' => ["Person's car", self::$chevy, 'Alice is the most recent Person in the store, and her most recent car is the Chevrolet'], |
|
| 80 | + 'Related Nth Noun' => ["Person's 1st car", self::$ford, 'Alice is the most recent Person in the store, and her 1st car is the Ford'], |
|
| 81 | + 'Nth Nouns Related Noun' => ["1st Person's car", self::$toyota, 'Bob is the 1st Person in the store, and his most recent car is the Toyota'], |
|
| 82 | + 'Nth Nouns Related Nth Noun' => ["1st Person's 1st car", self::$kia, 'Bob is the 1st Person in the store, and his 1st car is the Kia'], |
|
| 83 | + 'Missing Noun' => ['Dog', null, 'Dog does not exist in the store'], |
|
| 84 | + 'Missing Nth Noun' => ['3rd Person', null, '3rd Person does not exist in the store'], |
|
| 85 | + 'Missing Related Noun' => ["Person's dog", null, 'Alice is the most recent Person in the store, but has no dog'], |
|
| 86 | 86 | ]; |
| 87 | 87 | } |
| 88 | 88 | |