From 21f9665abb0e946f9da6148b6edb97a6080c1680 Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Wed, 23 Sep 2020 21:04:48 +0200 Subject: [PATCH 1/3] Convert unittests to use PHP 8 attributes See xp-framework/core#245 --- .../data/unittest/AggregationsTest.class.php | 6 +- .../data/unittest/BoundariesTest.class.php | 10 +-- .../data/unittest/CollectorsTest.class.php | 54 ++++++------- .../unittest/ContinuationOfTest.class.php | 8 +- .../php/util/data/unittest/EachTest.class.php | 22 +++--- .../data/unittest/EnumerationTest.class.php | 16 ++-- .../util/data/unittest/LimitTest.class.php | 12 +-- .../php/util/data/unittest/Methods.class.php | 2 +- .../util/data/unittest/OptionalTest.class.php | 50 ++++++------ .../php/util/data/unittest/PeekTest.class.php | 16 ++-- .../unittest/SequenceCollectionTest.class.php | 6 +- .../unittest/SequenceCreationTest.class.php | 27 +++---- .../unittest/SequenceFilteringTest.class.php | 16 ++-- .../unittest/SequenceFlatteningTest.class.php | 18 ++--- .../unittest/SequenceIteratorTest.class.php | 18 ++--- .../unittest/SequenceMappingTest.class.php | 18 ++--- .../unittest/SequenceReductionTest.class.php | 10 +-- .../unittest/SequenceResultSetTest.class.php | 6 +- .../data/unittest/SequenceSkipTest.class.php | 8 +- .../unittest/SequenceSortingTest.class.php | 16 ++-- .../util/data/unittest/SequenceTest.class.php | 77 ++++++++++--------- .../data/unittest/TraversalOfTest.class.php | 16 +--- .../data/unittest/YieldingOfTest.class.php | 8 +- 23 files changed, 212 insertions(+), 228 deletions(-) diff --git a/src/test/php/util/data/unittest/AggregationsTest.class.php b/src/test/php/util/data/unittest/AggregationsTest.class.php index fa6b783..bb90533 100755 --- a/src/test/php/util/data/unittest/AggregationsTest.class.php +++ b/src/test/php/util/data/unittest/AggregationsTest.class.php @@ -1,11 +1,11 @@ collecting($min, Aggregations::min()) @@ -22,7 +22,7 @@ public function min_max_sum_average_and_count_for_empty_sequence() { Assert::equals(0, $count); } - #[@test] + #[Test] public function min_max_sum_average_and_count_for_non_empty() { Sequence::of([1, 2, 3, 4]) ->collecting($min, Aggregations::min()) diff --git a/src/test/php/util/data/unittest/BoundariesTest.class.php b/src/test/php/util/data/unittest/BoundariesTest.class.php index a98f192..e5be95c 100755 --- a/src/test/php/util/data/unittest/BoundariesTest.class.php +++ b/src/test/php/util/data/unittest/BoundariesTest.class.php @@ -1,6 +1,6 @@ compareTo($a); }]; } - #[@test, @values('values')] + #[Test, Values('values')] public function min($min, $max, $values) { Assert::equals($min, Sequence::of($values)->min()); } - #[@test, @values('comparators')] + #[Test, Values('comparators')] public function min_using($comparator) { Assert::equals( new Date('1977-12-14'), @@ -32,12 +32,12 @@ public function min_using($comparator) { ); } - #[@test, @values('values')] + #[Test, Values('values')] public function max($min, $max, $values) { Assert::equals($max, Sequence::of($values)->max()); } - #[@test, @values('comparators')] + #[Test, Values('comparators')] public function max_using($comparator) { Assert::equals( new Date('2014-07-17'), diff --git a/src/test/php/util/data/unittest/CollectorsTest.class.php b/src/test/php/util/data/unittest/CollectorsTest.class.php index 511ae95..2b637e0 100755 --- a/src/test/php/util/data/unittest/CollectorsTest.class.php +++ b/src/test/php/util/data/unittest/CollectorsTest.class.php @@ -1,7 +1,7 @@ people= [ 1549 => new Employee(1549, 'Timm', 'B', 15), @@ -68,7 +68,7 @@ private function dinosaurEmployees() { ]; } - #[@test, @values('employeesName')] + #[Test, Values('employeesName')] public function toList($nameOf) { Assert::equals(['Timm', 'Alex', 'Dude'], Sequence::of($this->people) ->map($nameOf) @@ -77,7 +77,7 @@ public function toList($nameOf) { ); } - #[@test, @values('employeesName')] + #[Test, Values('employeesName')] public function toList_with_extraction($nameOf) { Assert::equals(['Timm', 'Alex', 'Dude'], Sequence::of($this->people) ->collect(Collectors::toList($nameOf)) @@ -85,7 +85,7 @@ public function toList_with_extraction($nameOf) { ); } - #[@test, @values('employeesName')] + #[Test, Values('employeesName')] public function toSet($nameOf) { Assert::equals(['Timm', 'Alex', 'Dude'], Sequence::of($this->people) ->map($nameOf) @@ -94,7 +94,7 @@ public function toSet($nameOf) { ); } - #[@test, @values('employeesName')] + #[Test, Values('employeesName')] public function toSet_with_extraction($nameOf) { Assert::equals(['Timm', 'Alex', 'Dude'], Sequence::of($this->people) ->collect(Collectors::toSet($nameOf)) @@ -102,7 +102,7 @@ public function toSet_with_extraction($nameOf) { ); } - #[@test, @values('employeesName')] + #[Test, Values('employeesName')] public function toCollection_with_HashSet_class($nameOf) { Assert::equals(['Timm', 'Alex', 'Dude'], Sequence::of($this->people) ->map($nameOf) @@ -111,7 +111,7 @@ public function toCollection_with_HashSet_class($nameOf) { ); } - #[@test, @values('employeesName')] + #[Test, Values('employeesName')] public function toMap($nameOf) { $map= new HashTable(); $map[1549]= 'Timm'; @@ -124,7 +124,7 @@ function($e) { return $e->id(); }, ))); } - #[@test, @values('employeesName')] + #[Test, Values('employeesName')] public function toMap_uses_complete_value_if_value_function_omitted($nameOf) { $map= new HashTable(); $map['Timm']= $this->people[1549]; @@ -137,7 +137,7 @@ public function toMap_uses_complete_value_if_value_function_omitted($nameOf) { ))); } - #[@test] + #[Test] public function toMap_can_use_sequence_keys() { $map= new HashTable(); $map['color']= 'green'; @@ -145,7 +145,7 @@ public function toMap_can_use_sequence_keys() { Assert::equals($map, Sequence::of(['color' => 'green'])->collect(Collectors::toMap())); } - #[@test] + #[Test] public function toMap_key_function_can_be_omitted() { $map= new HashTable(); $map['color']= 'GREEN'; @@ -156,7 +156,7 @@ public function toMap_key_function_can_be_omitted() { ))); } - #[@test] + #[Test] public function collect_with_key() { $result= Sequence::of(['color' => 'green', 'price' => 12.99])->collect(new Collector( function() { return []; }, @@ -165,14 +165,14 @@ function(&$result, $arg, $key) { $result[strtoupper($key)]= $arg; } Assert::equals(['COLOR' => 'green', 'PRICE' => 12.99], $result); } - #[@test, @values('employeesYears')] + #[Test, Values('employeesYears')] public function summing_years($yearsOf) { Assert::equals(33, Sequence::of($this->people) ->collect(Collectors::summing($yearsOf)) ); } - #[@test, @values('employeesYears')] + #[Test, Values('employeesYears')] public function summing_elements($yearsOf) { Assert::equals(33, Sequence::of($this->people) ->map($yearsOf) @@ -180,14 +180,14 @@ public function summing_elements($yearsOf) { ); } - #[@test, @values('employeesYears')] + #[Test, Values('employeesYears')] public function averaging_years($yearsOf) { Assert::equals(11, Sequence::of($this->people) ->collect(Collectors::averaging($yearsOf)) ); } - #[@test, @values('employeesYears')] + #[Test, Values('employeesYears')] public function averaging_elements($yearsOf) { Assert::equals(11, Sequence::of($this->people) ->map($yearsOf) @@ -195,21 +195,21 @@ public function averaging_elements($yearsOf) { ); } - #[@test] + #[Test] public function counting() { Assert::equals(3, Sequence::of($this->people) ->collect(Collectors::counting()) ); } - #[@test, @values('employeesDepartment')] + #[Test, Values('employeesDepartment')] public function mapping_by_department($departmentOf) { Assert::equals(new Vector(['B', 'I', 'I']), Sequence::of($this->people) ->collect(Collectors::mapping($departmentOf)) ); } - #[@test] + #[Test] public function joining_names() { Assert::equals('Timm, Alex, Dude', Sequence::of($this->people) ->map(function($e) { return $e->name(); }) @@ -217,7 +217,7 @@ public function joining_names() { ); } - #[@test] + #[Test] public function joining_names_with_semicolon() { Assert::equals('Timm;Alex;Dude', Sequence::of($this->people) ->map(function($e) { return $e->name(); }) @@ -225,7 +225,7 @@ public function joining_names_with_semicolon() { ); } - #[@test] + #[Test] public function joining_names_with_prefix_and_suffix() { Assert::equals('(Timm, Alex, Dude)', Sequence::of($this->people) ->map(function($e) { return $e->name(); }) @@ -233,7 +233,7 @@ public function joining_names_with_prefix_and_suffix() { ); } - #[@test, @values('employeesDepartment')] + #[Test, Values('employeesDepartment')] public function groupingBy($departmentOf) { $this->assertHashTable( ['B' => new Vector([$this->people[1549]]), 'I' => new Vector([$this->people[1552], $this->people[6100]])], @@ -241,7 +241,7 @@ public function groupingBy($departmentOf) { ); } - #[@test] + #[Test] public function groupingBy_with_summing_of_years() { $this->assertHashTable(['B' => 15, 'I' => 18], Sequence::of($this->people) ->collect(Collectors::groupingBy( @@ -251,7 +251,7 @@ function($e) { return $e->department(); }, ); } - #[@test] + #[Test] public function groupingBy_with_averaging_of_years() { $this->assertHashTable(['B' => 15, 'I' => 9], Sequence::of($this->people) ->collect(Collectors::groupingBy( @@ -261,7 +261,7 @@ function($e) { return $e->department(); }, ); } - #[@test, @values('dinosaurEmployees')] + #[Test, Values('dinosaurEmployees')] public function partitioningBy($moreThanTen) { $this->assertHashTable( [true => new Vector([$this->people[1549], $this->people[1552]]), false => new Vector([$this->people[6100]])], @@ -269,7 +269,7 @@ public function partitioningBy($moreThanTen) { ); } - #[@test] + #[Test] public function partitioningBy_handles_non_booleans() { $this->assertHashTable( [true => new Vector(['Test', 'Unittest']), false => new Vector(['Trial & Error'])], @@ -279,7 +279,7 @@ public function partitioningBy_handles_non_booleans() { ); } - #[@test] + #[Test] public function collecting_with_key() { Sequence::of($this->people) ->collecting($result, new Collector( diff --git a/src/test/php/util/data/unittest/ContinuationOfTest.class.php b/src/test/php/util/data/unittest/ContinuationOfTest.class.php index ae835ee..70ef303 100755 --- a/src/test/php/util/data/unittest/ContinuationOfTest.class.php +++ b/src/test/php/util/data/unittest/ContinuationOfTest.class.php @@ -1,11 +1,11 @@ getIterator(); $it->rewind(); @@ -13,7 +13,7 @@ public function at_beginning($input) { Assert::equals([0 => 1, 1 => 2, 2 => 3], iterator_to_array(new ContinuationOf($it))); } - #[@test, @values('util.data.unittest.Enumerables::validArrays')] + #[Test, Values('util.data.unittest.Enumerables::validArrays')] public function after_first($input) { $it= Sequence::of($input)->getIterator(); $it->rewind(); @@ -22,7 +22,7 @@ public function after_first($input) { Assert::equals([1 => 2, 2 => 3], iterator_to_array(new ContinuationOf($it))); } - #[@test, @values('util.data.unittest.Enumerables::validArrays')] + #[Test, Values('util.data.unittest.Enumerables::validArrays')] public function at_end($input) { $it= Sequence::of($input)->getIterator(); $it->rewind(); diff --git a/src/test/php/util/data/unittest/EachTest.class.php b/src/test/php/util/data/unittest/EachTest.class.php index 9c67291..8b636da 100755 --- a/src/test/php/util/data/unittest/EachTest.class.php +++ b/src/test/php/util/data/unittest/EachTest.class.php @@ -2,8 +2,8 @@ use io\streams\MemoryOutputStream; use lang\IllegalArgumentException; -use unittest\Assert; use unittest\actions\RuntimeVersion; +use unittest\{Action, Assert, Expect, Test, Values}; use util\cmd\Console; use util\data\Sequence; @@ -14,7 +14,7 @@ protected function invalidArguments() { return array_filter($this->noncallables(), function($args) { return null !== $args[0]; }); } - #[@test] + #[Test] public function each() { $collect= []; Sequence::of([1, 2, 3, 4])->each(function($e) use(&$collect) { @@ -23,7 +23,7 @@ public function each() { Assert::equals([1, 2, 3, 4], $collect); } - #[@test] + #[Test] public function with_key() { $collect= []; Sequence::of([1, 2, 3, 4])->each(function($e, $key) use(&$collect) { @@ -32,17 +32,17 @@ public function with_key() { Assert::equals([0, 1, 2, 3], $collect); } - #[@test, @values([[[1, 2, 3, 4]], [[]]])] + #[Test, Values([[[1, 2, 3, 4]], [[]]])] public function returns_number_of_processed_elements_with_func($input) { Assert::equals(sizeof($input), Sequence::of($input)->each(function($e) { })); } - #[@test, @values([[[1, 2, 3, 4]], [[]]])] + #[Test, Values([[[1, 2, 3, 4]], [[]]])] public function returns_number_of_processed_elements_with_null($input) { Assert::equals(sizeof($input), Sequence::of($input)->each()); } - #[@test] + #[Test] public function writing_to_stream() { $out= new MemoryOutputStream(); @@ -51,7 +51,7 @@ public function writing_to_stream() { Assert::equals('1234', $out->getBytes()); } - #[@test] + #[Test] public function writing_to_console_out() { $orig= Console::$out->getStream(); $out= new MemoryOutputStream(); @@ -66,7 +66,7 @@ public function writing_to_console_out() { Assert::equals('1234', $out->getBytes()); } - #[@test] + #[Test] public function with_var_export() { ob_start(); @@ -77,17 +77,17 @@ public function with_var_export() { Assert::equals('1234', $bytes); } - #[@test, @values('invalidArguments'), @expect(IllegalArgumentException::class)] + #[Test, Values('invalidArguments'), Expect(IllegalArgumentException::class)] public function raises_exception_when_given($noncallable) { Sequence::of([])->each($noncallable); } - #[@test, @expect(IllegalArgumentException::class)] + #[Test, Expect(IllegalArgumentException::class)] public function raises_exception_when_given_null_and_args() { Sequence::of([])->each(null, []); } - #[@test, @action([new RuntimeVersion('>=7.1.0')])] + #[Test, Action(eval: 'new RuntimeVersion(">=7.1.0")')] public function each_with_void() { Assert::equals(4, Sequence::of([1, 2, 3, 4])->each(eval('return function(int $e): void { };'))); } diff --git a/src/test/php/util/data/unittest/EnumerationTest.class.php b/src/test/php/util/data/unittest/EnumerationTest.class.php index ccc7fde..8279bbf 100755 --- a/src/test/php/util/data/unittest/EnumerationTest.class.php +++ b/src/test/php/util/data/unittest/EnumerationTest.class.php @@ -1,12 +1,12 @@ $value) { @@ -24,7 +24,7 @@ public function all_in_map($enumerable, $desc) { Assert::equals(['color' => 'green', 'price' => 12.99], $result, $desc); } - #[@test] + #[Test] public function all_in_sequence() { $result= []; foreach (Enumeration::of(Sequence::of([1, 2, 3])) as $value) { @@ -33,7 +33,7 @@ public function all_in_sequence() { Assert::equals([1, 2, 3], $result); } - #[@test] + #[Test] public function lazy_init_via_function() { $result= []; foreach (Enumeration::of(function() { return [1, 2, 3]; }) as $value) { @@ -42,17 +42,17 @@ public function lazy_init_via_function() { Assert::equals([1, 2, 3], $result); } - #[@test, @values('util.data.unittest.Enumerables::invalid'), @expect(IllegalArgumentException::class)] + #[Test, Values('util.data.unittest.Enumerables::invalid'), Expect(IllegalArgumentException::class)] public function raises_exception_when_given($value) { Enumeration::of($value); } - #[@test] + #[Test] public function returns_empty_enumerable_for_null() { Assert::equals([], Enumeration::of(null)); } - #[@test, @expect(IllegalArgumentException::class)] + #[Test, Expect(IllegalArgumentException::class)] public function returns_empty_enumerable_for_non_iterables() { Enumeration::of('a string'); } diff --git a/src/test/php/util/data/unittest/LimitTest.class.php b/src/test/php/util/data/unittest/LimitTest.class.php index 5836575..170c591 100755 --- a/src/test/php/util/data/unittest/LimitTest.class.php +++ b/src/test/php/util/data/unittest/LimitTest.class.php @@ -1,32 +1,32 @@ assertSequence([1, 2], Sequence::of([1, 2, 3])->limit(2)); } - #[@test] + #[Test] public function stops_at_nth_iterator_element() { $this->assertSequence([1, 2], Sequence::iterate(1, function($i) { return ++$i; })->limit(2)); } - #[@test] + #[Test] public function stops_at_nth_generator_element() { $i= 1; $this->assertSequence([1, 2], Sequence::generate(function() use(&$i) { return $i++; })->limit(2)); } - #[@test] + #[Test] public function stops_when_given_closure_returns_true() { $this->assertSequence([1, 2], Sequence::of([1, 2, 3, 4])->limit(function($e) { return $e > 2; })); } - #[@test] + #[Test] public function receives_offset() { $this->assertSequence([1, 2], Sequence::of([1, 2, 3, 4])->limit(function($e, $offset) { return $offset >= 2; })); } diff --git a/src/test/php/util/data/unittest/Methods.class.php b/src/test/php/util/data/unittest/Methods.class.php index 852e990..3a71c8c 100755 --- a/src/test/php/util/data/unittest/Methods.class.php +++ b/src/test/php/util/data/unittest/Methods.class.php @@ -17,4 +17,4 @@ public static function unaryop($in) { return $in; } */ public static function supplier() { return 1; } -} \ No newline at end of file +} diff --git a/src/test/php/util/data/unittest/OptionalTest.class.php b/src/test/php/util/data/unittest/OptionalTest.class.php index 1505ddc..79d0317 100755 --- a/src/test/php/util/data/unittest/OptionalTest.class.php +++ b/src/test/php/util/data/unittest/OptionalTest.class.php @@ -1,7 +1,7 @@ present()); } - #[@test] + #[Test] public function optional_created_via_of_with_null_is_not_present() { Assert::false(Optional::of(null)->present()); } - #[@test] + #[Test] public function empty_optional_is_not_present() { Assert::false(Optional::$EMPTY->present()); } - #[@test] + #[Test] public function get_returns_value_passed_to_of() { Assert::equals('Test', Optional::of('Test')->get()); } - #[@test, @expect(NoSuchElementException::class)] + #[Test, Expect(NoSuchElementException::class)] public function get_throws_exception_when_no_value_is_present() { Optional::$EMPTY->get(); } - #[@test] + #[Test] public function orElse_returns_value_passed_to_of() { Assert::equals('Test', Optional::of('Test')->orElse('Failed')); } - #[@test] + #[Test] public function orElse_returns_default_when_no_value_is_present() { Assert::equals('Succeeded', Optional::$EMPTY->orElse('Succeeded')); } - #[@test] + #[Test] public function orUse_returns_value_passed_to_of() { Assert::equals('Test', Optional::of('Test')->orUse(function() { throw new IllegalStateException('Not reached'); })); } - #[@test] + #[Test] public function orUse_invokes_supplier_when_no_value_is_present() { Assert::equals('Succeeded', Optional::$EMPTY->orUse(function() { return 'Succeeded'; })); } - #[@test] + #[Test] public function whenAbsent_returns_value_passed_to_of() { Assert::equals('Test', Optional::of('Test')->whenAbsent('Failed')->get()); } - #[@test] + #[Test] public function whenAbsent_returns_value_when_no_value_is_present() { Assert::equals('Succeeded', Optional::$EMPTY->whenAbsent('Succeeded')->get()); } - #[@test] + #[Test] public function whenAbsent_returns_optionals_value_when_no_value_is_present() { Assert::equals('Succeeded', Optional::$EMPTY->whenAbsent(Optional::of('Succeeded'))->get()); } - #[@test] + #[Test] public function whenAbsent_returns_functions_return_value_when_no_value_is_present() { Assert::equals('Succeeded', Optional::$EMPTY->whenAbsent(function() { return 'Succeeded'; })->get()); } - #[@test, @values('emptyValues')] + #[Test, Values('emptyValues')] public function whenAbsent_chaining($value) { Assert::equals('Succeeded', Optional::$EMPTY->whenAbsent($value)->whenAbsent('Succeeded')->get()); } - #[@test] + #[Test] public function can_be_used_in_foreach() { Assert::equals(['Test'], iterator_to_array(Optional::of('Test'))); } - #[@test] + #[Test] public function empty_can_be_used_in_foreach() { Assert::equals([], iterator_to_array(Optional::$EMPTY)); } - #[@test] + #[Test] public function filter_returns_empty_when_no_value_present() { Assert::equals(Optional::$EMPTY, Optional::$EMPTY->filter('is_array')); } - #[@test] + #[Test] public function filter_returns_self_when_predicate_matches() { Assert::equals([1, 2, 3], Optional::of([1, 2, 3])->filter('is_array')->get()); } - #[@test] + #[Test] public function filter_returns_empty_when_predicate_does_not_match() { Assert::equals(Optional::$EMPTY, Optional::of('test')->filter('is_array')); } - #[@test] + #[Test] public function filter_with_filter_instance() { $filter= new class() implements Filter { public function accept($value) { return preg_match('/^www/', $value); } @@ -120,22 +120,22 @@ public function accept($value) { return preg_match('/^www/', $value); } Assert::equals('www.example.com', Optional::of('www.example.com')->filter($filter)->get()); } - #[@test] + #[Test] public function map_applies_function_when_value_present() { Assert::equals('123', Optional::of([1, 2, 3])->map('implode')->get()); } - #[@test] + #[Test] public function map_returns_empty_when_no_value_present() { Assert::equals(Optional::$EMPTY, Optional::$EMPTY->map('implode')); } - #[@test] + #[Test] public function toString_for_empty_optional() { Assert::equals('util.data.Optional', Optional::$EMPTY->toString()); } - #[@test] + #[Test] public function toString_for_sequence_of_array() { Assert::equals('util.data.Optional@[1, 2, 3]', Optional::of([1, 2, 3])->toString()); } diff --git a/src/test/php/util/data/unittest/PeekTest.class.php b/src/test/php/util/data/unittest/PeekTest.class.php index 4beb8ac..2c4364c 100755 --- a/src/test/php/util/data/unittest/PeekTest.class.php +++ b/src/test/php/util/data/unittest/PeekTest.class.php @@ -2,19 +2,19 @@ use io\streams\MemoryOutputStream; use lang\IllegalArgumentException; -use unittest\Assert; use unittest\actions\RuntimeVersion; +use unittest\{Action, Assert, Expect, Test, Values}; use util\cmd\Console; use util\data\Sequence; class PeekTest extends AbstractSequenceTest { - #[@test, @expect(IllegalArgumentException::class)] + #[Test, Expect(IllegalArgumentException::class)] public function invalid() { Sequence::$EMPTY->peek('@non-existant-func@'); } - #[@test] + #[Test] public function values() { $debug= []; Sequence::of([1, 2, 3, 4]) @@ -25,7 +25,7 @@ public function values() { Assert::equals([1, 3], $debug); } - #[@test] + #[Test] public function keys() { $debug= []; Sequence::of([1, 2, 3, 4]) @@ -36,7 +36,7 @@ public function keys() { Assert::equals([0, 2], $debug); } - #[@test] + #[Test] public function writing_to_console_out() { $orig= Console::$out->getStream(); $out= new MemoryOutputStream(); @@ -53,7 +53,7 @@ public function writing_to_console_out() { Assert::equals('1234', $out->getBytes()); } - #[@test] + #[Test] public function with_var_export() { ob_start(); @@ -64,12 +64,12 @@ public function with_var_export() { Assert::equals('1234', $bytes); } - #[@test, @values('noncallables'), @expect(IllegalArgumentException::class)] + #[Test, Values('noncallables'), Expect(IllegalArgumentException::class)] public function raises_exception_when_given($noncallable) { Sequence::of([])->peek($noncallable); } - #[@test, @action([new RuntimeVersion('>=7.1.0')])] + #[Test, Action(eval: 'new RuntimeVersion(">=7.1.0")')] public function each_with_void() { Assert::equals(4, Sequence::of([1, 2, 3, 4])->peek(eval('return function(int $e): void { };'))->each()); } diff --git a/src/test/php/util/data/unittest/SequenceCollectionTest.class.php b/src/test/php/util/data/unittest/SequenceCollectionTest.class.php index cd430cb..958189c 100755 --- a/src/test/php/util/data/unittest/SequenceCollectionTest.class.php +++ b/src/test/php/util/data/unittest/SequenceCollectionTest.class.php @@ -1,11 +1,11 @@ collect(new Collector( function() { return ['total' => 0, 'sum' => 0]; }, @@ -14,7 +14,7 @@ function(&$result, $arg) { $result['total']++; $result['sum']+= $arg; } Assert::equals(2.5, $result['sum'] / $result['total']); } - #[@test] + #[Test] public function used_for_joining() { $result= Sequence::of(['a', 'b', 'c'])->collect(new Collector( function() { return ''; }, diff --git a/src/test/php/util/data/unittest/SequenceCreationTest.class.php b/src/test/php/util/data/unittest/SequenceCreationTest.class.php index 3222d60..7f46b7f 100755 --- a/src/test/php/util/data/unittest/SequenceCreationTest.class.php +++ b/src/test/php/util/data/unittest/SequenceCreationTest.class.php @@ -1,7 +1,7 @@ assertSequence([1, 2, 3], Sequence::of($sequence)); } - #[@test, @values([ - # [[1, 2, 3, 4, 5, 6]], - # [[1, 2, 3], [4, 5, 6]], - # [[1], [2, 3], [4, 5, 6]], - # [[1, 2], null, [3, 4, 5, 6]] - #])] + #[Test, Values([[[1, 2, 3, 4, 5, 6]], [[1, 2, 3], [4, 5, 6]], [[1], [2, 3], [4, 5, 6]], [[1, 2], null, [3, 4, 5, 6]]])] public function multiple_arguments_supported_in_of(... $input) { $this->assertSequence([1, 2, 3, 4, 5, 6], Sequence::of(...$input)); } diff --git a/src/test/php/util/data/unittest/SequenceFilteringTest.class.php b/src/test/php/util/data/unittest/SequenceFilteringTest.class.php index c238c6e..e941baf 100755 --- a/src/test/php/util/data/unittest/SequenceFilteringTest.class.php +++ b/src/test/php/util/data/unittest/SequenceFilteringTest.class.php @@ -1,49 +1,49 @@ assertSequence([2, 4], Sequence::of([1, 2, 3, 4])->filter(function($e) { return 0 === $e % 2; })); } - #[@test] + #[Test] public function with_is_string_native_function() { $this->assertSequence(['Hello', 'World'], Sequence::of(['Hello', 1337, 'World'])->filter('is_string')); } - #[@test] + #[Test] public function with_filter_instance() { $this->assertSequence(['Hello', 'World'], Sequence::of(['Hello', '', 'World'])->filter(newinstance(Filter::class, [], [ 'accept' => function($e) { return strlen($e) > 0; } ]))); } - #[@test] + #[Test] public function with_generic_filter_instance() { $this->assertSequence(['Hello', 'World'], Sequence::of(['Hello', '', 'World'])->filter(newinstance('util.Filter', [], [ 'accept' => function($e) { return strlen($e) > 0; } ]))); } - #[@test, @values('noncallables'), @expect(IllegalArgumentException::class)] + #[Test, Values('noncallables'), Expect(IllegalArgumentException::class)] public function raises_exception_when_given($noncallable) { Sequence::of([])->filter($noncallable); } - #[@test] + #[Test] public function array_index_is_passed_to_function() { $keys= []; Sequence::of([1, 2, 3])->filter(function($e, $key) use(&$keys) { $keys[]= $key; return true; })->each(); Assert::equals([0, 1, 2], $keys); } - #[@test] + #[Test] public function map_key_is_passed_to_function() { $keys= []; Sequence::of(['one' => 1, 'two' => 2, 'three' => 3])->filter(function($e, $key) use(&$keys) { $keys[]= $key; return true; })->each(); diff --git a/src/test/php/util/data/unittest/SequenceFlatteningTest.class.php b/src/test/php/util/data/unittest/SequenceFlatteningTest.class.php index 990a86b..2df9fbd 100755 --- a/src/test/php/util/data/unittest/SequenceFlatteningTest.class.php +++ b/src/test/php/util/data/unittest/SequenceFlatteningTest.class.php @@ -1,29 +1,29 @@ assertSequence(['a', 'b', 'c', 'd'], Sequence::of([['a', 'b'], ['c', 'd']])->flatten()); } - #[@test] + #[Test] public function flatten_with_mapper() { $this->assertSequence(['a', 'b', 'c', 'd'], Sequence::of(['a', 'c'])->flatten(function($e) { return Sequence::iterate($e, function($n) { return ++$n; })->limit(2); })); } - #[@test] + #[Test] public function flatten_optionals() { $this->assertSequence(['a', 'b'], Sequence::of([Optional::of('a'), Optional::$EMPTY, Optional::of('b')])->flatten()); } - #[@test, @values('noncallables'), @expect(IllegalArgumentException::class)] + #[Test, Values('noncallables'), Expect(IllegalArgumentException::class)] public function flatten_raises_exception_when_given($noncallable) { if (null === $noncallable) { throw new IllegalArgumentException('Valid use-case'); @@ -31,21 +31,21 @@ public function flatten_raises_exception_when_given($noncallable) { Sequence::of([])->flatten($noncallable); } - #[@test] + #[Test] public function array_index_is_passed_to_function() { $keys= []; Sequence::of([['a', 'b'], ['c', 'd']])->flatten(function($e, $key) use(&$keys) { $keys[]= $key; return $e; })->each(); Assert::equals([0, 1], $keys); } - #[@test] + #[Test] public function map_key_is_passed_to_function() { $keys= []; Sequence::of(['one' => [1], 'two' => [2], 'three' => [3]])->flatten(function($e, $key) use(&$keys) { $keys[]= $key; return $e; })->each(); Assert::equals(['one', 'two', 'three'], $keys); } - #[@test] + #[Test] public function flatten_generator() { $this->assertSequence([2, 4, 0, 4, 1], Sequence::of([2])->flatten(function($n) { yield $n; @@ -56,7 +56,7 @@ public function flatten_generator() { })); } - #[@test] + #[Test] public function flatten_generator_with_key() { $this->assertSequence([3, 6], Sequence::of([1 => 2])->flatten(function($n, $key) { yield $n + $key; diff --git a/src/test/php/util/data/unittest/SequenceIteratorTest.class.php b/src/test/php/util/data/unittest/SequenceIteratorTest.class.php index bdf099e..fdf419b 100755 --- a/src/test/php/util/data/unittest/SequenceIteratorTest.class.php +++ b/src/test/php/util/data/unittest/SequenceIteratorTest.class.php @@ -1,6 +1,6 @@ iterator()->hasNext()); } - #[@test] + #[Test] public function next() { Assert::equals(1, Sequence::of([1])->iterator()->next()); } - #[@test] + #[Test] public function hasNext_returns_false_when_at_end_of_sequence() { Assert::false(Sequence::$EMPTY->iterator()->hasNext()); } - #[@test, @expect(NoSuchElementException::class)] + #[Test, Expect(NoSuchElementException::class)] public function next_throws_exception_when_at_end_of_sequence() { Sequence::$EMPTY->iterator()->next(); } - #[@test, @values('util.data.unittest.Enumerables::validArrays')] + #[Test, Values('util.data.unittest.Enumerables::validArrays')] public function iterator($input) { Assert::equals([1, 2, 3], $this->iterated(Sequence::of($input)->iterator())); } - #[@test, @values('util.data.unittest.Enumerables::fixedArrays')] + #[Test, Values('util.data.unittest.Enumerables::fixedArrays')] public function may_iterate_sequence_based_on_a_fixed_enumerable_more_than_once($input) { $seq= Sequence::of($input); $this->iterated($seq->iterator()); $this->iterated($seq->iterator()); } - #[@test, @values('util.data.unittest.Enumerables::streamedArrays')] + #[Test, Values('util.data.unittest.Enumerables::streamedArrays')] public function cannot_iterate_sequence_based_on_a_streamed_enumerable_more_than_once($input) { $seq= Sequence::of($input); $this->iterated($seq->iterator()); @@ -62,7 +62,7 @@ public function cannot_iterate_sequence_based_on_a_streamed_enumerable_more_than }); } - #[@test, @values('util.data.unittest.Enumerables::validArrays')] + #[Test, Values('util.data.unittest.Enumerables::validArrays')] public function sequence_of_iterator($input) { $this->assertSequence([1, 2, 3], Sequence::of(Sequence::of($input)->iterator())); } diff --git a/src/test/php/util/data/unittest/SequenceMappingTest.class.php b/src/test/php/util/data/unittest/SequenceMappingTest.class.php index 62ebc1f..a1c924b 100755 --- a/src/test/php/util/data/unittest/SequenceMappingTest.class.php +++ b/src/test/php/util/data/unittest/SequenceMappingTest.class.php @@ -1,42 +1,42 @@ assertSequence([2, 4, 6, 8], Sequence::of([1, 2, 3, 4])->map(function($e) { return $e * 2; })); } - #[@test] + #[Test] public function with_with_floor_native_function() { $this->assertSequence([1.0, 2.0, 3.0], Sequence::of([1.9, 2.5, 3.1])->map('floor')); } - #[@test, @values('noncallables'), @expect(IllegalArgumentException::class)] + #[Test, Values('noncallables'), Expect(IllegalArgumentException::class)] public function map_raises_exception_when_given($noncallable) { Sequence::of([])->map($noncallable); } - #[@test] + #[Test] public function array_index_is_passed_to_function() { $keys= []; Sequence::of([1, 2, 3])->map(function($e, $key) use(&$keys) { $keys[]= $key; return $e; })->each(); Assert::equals([0, 1, 2], $keys); } - #[@test] + #[Test] public function map_key_is_passed_to_function() { $keys= []; Sequence::of(['one' => 1, 'two' => 2, 'three' => 3])->map(function($e, $key) use(&$keys) { $keys[]= $key; return $e; })->each(); Assert::equals(['one', 'two', 'three'], $keys); } - #[@test] + #[Test] public function with_instance_method() { $people= [new Person(1549, 'Timm'), new Person(6100, 'Test')]; $this->assertSequence( @@ -45,14 +45,14 @@ public function with_instance_method() { ); } - #[@test] + #[Test] public function with_generator() { $records= Sequence::of([['unit' => 'yellow', 'amount' => 20], ['unit' => 'blue', 'amount' => 19]]); $generator= function($record) { yield $record['unit'] => $record['amount']; }; Assert::equals(['yellow' => 20, 'blue' => 19], $records->map($generator)->toMap()); } - #[@test] + #[Test] public function with_generator_and_key() { $records= Sequence::of(['color' => 'green', 'price' => 12.99]); $generator= function($value, $key) { yield strtoupper($key) => $value; }; diff --git a/src/test/php/util/data/unittest/SequenceReductionTest.class.php b/src/test/php/util/data/unittest/SequenceReductionTest.class.php index 03d4be2..d3c3e1c 100755 --- a/src/test/php/util/data/unittest/SequenceReductionTest.class.php +++ b/src/test/php/util/data/unittest/SequenceReductionTest.class.php @@ -1,32 +1,32 @@ reduce(-1, function($a, $b) { $this->fail('Should not be called'); })); } - #[@test] + #[Test] public function used_for_summing() { Assert::equals(10, Sequence::of([1, 2, 3, 4])->reduce(0, function($a, $b) { return $a + $b; })); } - #[@test] + #[Test] public function used_for_max() { Assert::equals(10, Sequence::of([7, 1, 10, 3])->reduce(0, function($a, $b) { return $a < $b ? $b : $a; })); } - #[@test] + #[Test] public function used_for_concatenation() { Assert::equals('Hello World', Sequence::of(['Hello', ' ', 'World'])->reduce('', function($a, $b) { return $a.$b; diff --git a/src/test/php/util/data/unittest/SequenceResultSetTest.class.php b/src/test/php/util/data/unittest/SequenceResultSetTest.class.php index 6b65fa0..0eda71f 100755 --- a/src/test/php/util/data/unittest/SequenceResultSetTest.class.php +++ b/src/test/php/util/data/unittest/SequenceResultSetTest.class.php @@ -1,6 +1,6 @@ fetched= []; $values= $this->records(3)->map(function($e) { return $e['name']; })->toArray(); @@ -51,7 +51,7 @@ public function three_records() { ); } - #[@test] + #[Test] public function two_records() { $this->fetched= []; $values= $this->records(2)->map(function($e) { return $e['name']; })->toArray(); diff --git a/src/test/php/util/data/unittest/SequenceSkipTest.class.php b/src/test/php/util/data/unittest/SequenceSkipTest.class.php index 1c5781a..22a2075 100755 --- a/src/test/php/util/data/unittest/SequenceSkipTest.class.php +++ b/src/test/php/util/data/unittest/SequenceSkipTest.class.php @@ -1,21 +1,21 @@ assertSequence([3, 4], Sequence::of([1, 2, 3, 4])->skip(2)); } - #[@test] + #[Test] public function excludes_elements_when_given_closure_returns_true() { $this->assertSequence([3, 4], Sequence::of([1, 2, 3, 4])->skip(function($e) { return $e < 3; })); } - #[@test] + #[Test] public function receives_offset() { $this->assertSequence([3, 4], Sequence::of([1, 2, 3, 4])->skip(function($e, $offset) { return $offset < 2; })); } diff --git a/src/test/php/util/data/unittest/SequenceSortingTest.class.php b/src/test/php/util/data/unittest/SequenceSortingTest.class.php index 12c8147..3ccb468 100755 --- a/src/test/php/util/data/unittest/SequenceSortingTest.class.php +++ b/src/test/php/util/data/unittest/SequenceSortingTest.class.php @@ -1,26 +1,22 @@ assertSequence($result, Sequence::of($input)->sorted()); } - #[@test] + #[Test] public function sorted_with_flags() { $this->assertSequence([3, 2, 1], Sequence::of([1, 2, 3])->sorted(SORT_NUMERIC | SORT_DESC)); } - #[@test] + #[Test] public function sorted_by_comparator() { $this->assertSequence( [new Date('1977-12-14'), new Date('1979-12-29')], @@ -30,7 +26,7 @@ public function sorted_by_comparator() { ); } - #[@test] + #[Test] public function sorted_by_compareTo() { $this->assertSequence( [new Date('1979-12-29'), new Date('1977-12-14')], @@ -38,7 +34,7 @@ public function sorted_by_compareTo() { ); } - #[@test] + #[Test] public function sorted_by_natural_order_string_comparison() { $this->assertSequence( ['rfc1.txt', 'rfc822.txt', 'rfc2086.txt'], diff --git a/src/test/php/util/data/unittest/SequenceTest.class.php b/src/test/php/util/data/unittest/SequenceTest.class.php index 548261c..6c3b593 100755 --- a/src/test/php/util/data/unittest/SequenceTest.class.php +++ b/src/test/php/util/data/unittest/SequenceTest.class.php @@ -1,6 +1,6 @@ assertSequence([], Sequence::$EMPTY); } - #[@test] + #[Test] public function toArray_for_empty_sequence() { Assert::equals([], Sequence::$EMPTY->toArray()); } - #[@test, @values('util.data.unittest.Enumerables::validArrays')] + #[Test, Values('util.data.unittest.Enumerables::validArrays')] public function toArray_returns_elements_as_array($input, $name) { Assert::equals([1, 2, 3], Sequence::of($input)->toArray(), $name); } - #[@test] + #[Test] public function toArray_optionally_accepts_mapper() { Assert::equals( [2, 4], @@ -44,17 +44,17 @@ public function toArray_optionally_accepts_mapper() { ); } - #[@test] + #[Test] public function toMap_for_empty_sequence() { Assert::equals([], Sequence::$EMPTY->toMap()); } - #[@test, @values('util.data.unittest.Enumerables::validMaps')] + #[Test, Values('util.data.unittest.Enumerables::validMaps')] public function toMap_returns_elements_as_map($input) { Assert::equals(['color' => 'green', 'price' => 12.99], Sequence::of($input)->toMap()); } - #[@test] + #[Test] public function toMap_optionally_accepts_mapper() { Assert::equals( ['a' => 2, 'b' => 4], @@ -62,49 +62,50 @@ public function toMap_optionally_accepts_mapper() { ); } - #[@test, @values([ - # [0, []], - # [1, [1]], - # [4, [1, 2, 3, 4]] - #])] + #[Test, Values([[0, []], [1, [1]], [4, [1, 2, 3, 4]]])] public function count($length, $values) { Assert::equals($length, Sequence::of($values)->count()); } - #[@test] + #[Test] public function first_returns_non_present_optional_for_empty_input() { Assert::false(Sequence::of([])->first()->present()); } - #[@test] + #[Test] public function first_returns_present_optional_even_for_null() { Assert::true(Sequence::of([null])->first()->present()); } - #[@test] + #[Test] public function first_returns_first_array_element() { Assert::equals(1, Sequence::of([1, 2, 3])->first()->get()); } - #[@test] + #[Test] public function first_returns_first_element_to_match_its_filter() { Assert::equals(2, Sequence::of([1, 2, 3])->first(function($i) { return 0 === $i % 2; })->get()); } - #[@test] + #[Test] public function first_returns_non_present_optional_if_no_element_matches_its_filter() { Assert::false(Sequence::of([1, 3])->first(function($i) { return 0 === $i % 2; })->present()); } - #[@test, @values([ - # [[1, 2, 3], [1, 2, 2, 3, 1, 3]], - # [[new Name('a'), new Name('b')], [new Name('a'), new Name('a'), new Name('b')]] - #])] - public function distinct($result, $input) { - $this->assertSequence($result, Sequence::of($input)->distinct()); + #[Test] + public function distinct() { + $this->assertSequence([1, 2, 3], Sequence::of([1, 2, 2, 3, 1, 3])->distinct()); } - #[@test] + #[Test] + public function distinct_objects() { + $this->assertSequence( + [new Name('a'), new Name('b')], + Sequence::of([new Name('a'), new Name('a'), new Name('b')])->distinct() + ); + } + + #[Test] public function distinct_with_function() { $function= function($record) { return $record['id']; }; $this->assertSequence( @@ -113,56 +114,56 @@ public function distinct_with_function() { ); } - #[@test] + #[Test] public function is_useable_inside_foreach() { Assert::equals([1, 2, 3], iterator_to_array(Sequence::of([1, 2, 3]))); } - #[@test, @values([[['a', 'b', 'c', 'd']], [[]]])] + #[Test, Values([[['a', 'b', 'c', 'd']], [[]]])] public function counting($input) { $i= 0; Sequence::of($input)->counting($i)->each(); Assert::equals(sizeof($input), $i); } - #[@test, @values('util.data.unittest.Enumerables::fixedArrays')] + #[Test, Values('util.data.unittest.Enumerables::fixedArrays')] public function may_use_sequence_based_on_a_fixed_enumerable_more_than_once($input) { $seq= Sequence::of($input); $seq->each(); $seq->each(); } - #[@test, @values('util.data.unittest.Enumerables::streamedArrays')] + #[Test, Values('util.data.unittest.Enumerables::streamedArrays')] public function cannot_use_toArray_on_a_sequence_based_on_a_streamed_enumerable_twice($input) { $this->assertNotTwice(Sequence::of($input), function($seq) { $seq->toArray(); }); } - #[@test, @values('util.data.unittest.Enumerables::streamedArrays')] + #[Test, Values('util.data.unittest.Enumerables::streamedArrays')] public function cannot_use_each_on_a_sequence_based_on_a_streamed_enumerable_twice($input) { $this->assertNotTwice(Sequence::of($input), function($seq) { $seq->each(); }); } - #[@test, @values('util.data.unittest.Enumerables::streamedArrays')] + #[Test, Values('util.data.unittest.Enumerables::streamedArrays')] public function cannot_use_first_on_a_sequence_based_on_a_streamed_enumerable_twice($input) { $this->assertNotTwice(Sequence::of($input), function($seq) { $seq->first(); }); } - #[@test, @values('util.data.unittest.Enumerables::streamedArrays')] + #[Test, Values('util.data.unittest.Enumerables::streamedArrays')] public function cannot_use_count_on_a_sequence_based_on_a_streamed_enumerable_twice($input) { $this->assertNotTwice(Sequence::of($input), function($seq) { $seq->count(); }); } - #[@test, @values('util.data.unittest.Enumerables::streamedArrays')] + #[Test, Values('util.data.unittest.Enumerables::streamedArrays')] public function cannot_use_min_on_a_sequence_based_on_a_streamed_enumerable_twice($input) { $this->assertNotTwice(Sequence::of($input), function($seq) { $seq->min(); }); } - #[@test, @values('util.data.unittest.Enumerables::streamedArrays')] + #[Test, Values('util.data.unittest.Enumerables::streamedArrays')] public function cannot_use_max_on_a_sequence_based_on_a_streamed_enumerable_twice($input) { $this->assertNotTwice(Sequence::of($input), function($seq) { $seq->max(); }); } - #[@test, @values('util.data.unittest.Enumerables::streamedArrays')] + #[Test, Values('util.data.unittest.Enumerables::streamedArrays')] public function cannot_use_collect_on_a_sequence_based_on_a_streamed_enumerable_twice($input) { $this->assertNotTwice(Sequence::of($input), function($seq) { $seq->collect(new Collector( function() { return 0; }, @@ -170,7 +171,7 @@ function(&$r, $e) { /* Intentionally empty */ } )); }); } - #[@test, @values('util.data.unittest.Enumerables::streamedArrays')] + #[Test, Values('util.data.unittest.Enumerables::streamedArrays')] public function cannot_use_reduce_on_a_sequence_based_on_a_streamed_enumerable_twice($input) { $this->assertNotTwice(Sequence::of($input), function($seq) { $seq->reduce( 0, @@ -178,12 +179,12 @@ function($r, $e) { /* Intentionally empty */ }); }); } - #[@test] + #[Test] public function toString_for_empty_sequence() { Assert::equals('util.data.Sequence', Sequence::$EMPTY->toString()); } - #[@test] + #[Test] public function toString_for_sequence_of_array() { Assert::equals('util.data.Sequence@[1, 2, 3]', Sequence::of([1, 2, 3])->toString()); } diff --git a/src/test/php/util/data/unittest/TraversalOfTest.class.php b/src/test/php/util/data/unittest/TraversalOfTest.class.php index 22fe911..b39d285 100755 --- a/src/test/php/util/data/unittest/TraversalOfTest.class.php +++ b/src/test/php/util/data/unittest/TraversalOfTest.class.php @@ -1,25 +1,17 @@ 'value']] - #])] + #[Test, Values([[[]], [[1, 2, 3]], [['key' => 'value']]])] public function iteration($input) { Assert::equals($input, iterator_to_array(new TraversalOf(new \ArrayIterator($input)))); } - #[@test, @values([ - # [\Exception::class], - # [CannotReset::class], - # [IllegalStateException::class] - #])] + #[Test, Values([[\Exception::class], [CannotReset::class], [IllegalStateException::class]])] public function exceptions_from_rewind_are_wrapped_in_cannot_reset($class) { $fixture= new TraversalOf(newinstance(\Iterator::class, [], [ 'started' => false, @@ -41,7 +33,7 @@ public function exceptions_from_rewind_are_wrapped_in_cannot_reset($class) { }); } - #[@test] + #[Test] public function exceptions_during_iteration_are_left_untouched() { $fixture= new TraversalOf(newinstance(\Iterator::class, [], [ 'rewind' => function() { }, diff --git a/src/test/php/util/data/unittest/YieldingOfTest.class.php b/src/test/php/util/data/unittest/YieldingOfTest.class.php index fdbf452..49e6c48 100755 --- a/src/test/php/util/data/unittest/YieldingOfTest.class.php +++ b/src/test/php/util/data/unittest/YieldingOfTest.class.php @@ -1,6 +1,6 @@ 'value'; }, ['key' => 'value']]; } - #[@test, @values('fixtures')] + #[Test, Values('fixtures')] public function iteration($generator, $expected) { Assert::equals($expected, iterator_to_array(new YieldingOf($generator()))); } - #[@test, @values('fixtures')] + #[Test, Values('fixtures')] public function cannot_rewind_after_rewind($generator) { $fixture= new YieldingOf($generator()); $fixture->rewind(); @@ -29,7 +29,7 @@ public function cannot_rewind_after_rewind($generator) { }); } - #[@test, @values('fixtures')] + #[Test, Values('fixtures')] public function cannot_rewind_after_complete_iteration($generator) { $fixture= new YieldingOf($generator()); iterator_to_array($fixture); From 9dc3e2dfda2aec8073d02b5923ad8d6efbeaf4c9 Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Wed, 23 Sep 2020 21:14:09 +0200 Subject: [PATCH 2/3] Use XP framework core branch with PHP 8 attribute support --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 10fb480..118acb1 100755 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "description" : "Data sequences", "keywords": ["module", "xp"], "require" : { - "xp-framework/core": "^10.0 | ^9.0 | ^8.0 | ^7.0", + "xp-framework/core": "dev-feature/yield-attributes-as-annotations as 10.2.0", "xp-framework/collections": "^9.0 | ^8.0 | ^7.0", "php" : ">=7.0.0" }, From b8e82e9afc225b36d6cd6c0568c9d496a372b0a1 Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Wed, 23 Sep 2020 23:18:43 +0200 Subject: [PATCH 3/3] Use XP 10.2.0 now that it has been released --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 118acb1..b99c898 100755 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "description" : "Data sequences", "keywords": ["module", "xp"], "require" : { - "xp-framework/core": "dev-feature/yield-attributes-as-annotations as 10.2.0", + "xp-framework/core": "^10.2", "xp-framework/collections": "^9.0 | ^8.0 | ^7.0", "php" : ">=7.0.0" },