public function testAfterFilters() { $collection = new Collection(); $taskA = new CollectionTestTask('a', 'value-a'); $taskB = new CollectionTestTask('b', 'value-b'); $collection->add($taskA, 'a-name')->add($taskB, 'b-name'); // We add methods of our task instances as before and // after tasks. These methods have access to the task // class' fields, and may modify them as needed. $collection->after('a-name', [$taskA, 'parenthesizer'])->after('a-name', [$taskA, 'emphasizer'])->after('b-name', [$taskB, 'emphasizer'])->after('b-name', [$taskB, 'parenthesizer'])->after('b-name', [$taskB, 'parenthesizer'], 'special-name'); $result = $collection->run(); // verify(var_export($result->getData(), true))->equals(''); // Ensure that the results have the correct key values verify(implode(',', array_keys($result->getData())))->equals('a-name,b-name,special-name,time'); // Verify that all of the after tasks ran in // the correct order. verify($result['a-name']['a'])->equals('*(value-a)*'); verify($result['b-name']['b'])->equals('(*value-b*)'); // Note that the last after task is added with a special name; // its results therefore show up under the name given, rather // than being stored under the name of the task it was added after. verify($result['special-name']['b'])->equals('((*value-b*))'); }