Skip to content

Commit 05a739d

Browse files
committed
Don't pass TCM::Config->args to test class constructors
Also deprecate this method since it's no longer needed.
1 parent b59432e commit 05a739d

File tree

6 files changed

+29
-12
lines changed

6 files changed

+29
-12
lines changed

Changes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ Revision history for Perl distribution Test-Class-Moose
22

33
{{$NEXT}}
44

5+
[BACKWARDS INCOMPATIBILITIES]
6+
7+
* The value of Test::Class::Moose::Config->args is no longer passed to the
8+
constructor for each test class instance. This was a holdover from when
9+
Test::Class::Moose was both a parent class for your test classes and the
10+
test class runner. Fixes GH #68. Reported by Noel Maddy.
11+
512
0.78 2016-08-21
613

714
[ENHANCEMENTS]

lib/Test/Class/Moose.pm

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,16 @@ for you, see L<Test::Class::Moose::Role::AutoUse> in this distribution.
877877
878878
=head1 DEPRECATIONS AND BACKWARDS INCOMPATIBILITIES
879879
880+
=head2 Version 0.79
881+
882+
=over 4
883+
884+
=item *
885+
886+
The L<Test::Class::Moose::Config> class's C<args> method is now
887+
deprecated. was a holdover from when Test::Class::Moose was both a parent
888+
class for your test classes and the test class runner.
889+
880890
=head2 Version 0.77
881891
882892
=over 4

lib/Test/Class/Moose/Config.pm

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ use Moose;
1010
use Moose::Util::TypeConstraints;
1111
use namespace::autoclean;
1212

13+
use Test::Class::Moose::Deprecated;
14+
1315
subtype 'ArrayRefOfStrings', as 'Maybe[ArrayRef[Str]]';
1416

1517
coerce 'ArrayRefOfStrings', from 'Str', via { defined($_) ? [$_] : undef };
@@ -99,6 +101,8 @@ has 'test_classes' => (
99101
sub args {
100102
my $self = shift;
101103

104+
Test::Class::Moose::Deprecated::deprecated();
105+
102106
return (
103107
map { defined $self->$_ ? ( $_ => $self->$_ ) : () }
104108
map { $_->name } $self->meta->get_all_attributes
@@ -194,10 +198,9 @@ Boolean. Will run test classes in a random order.
194198
195199
=head2 C<args>
196200
197-
my $tests = Some::Test::Class->new($test_suite->test_configuration->args);
198-
199-
Returns a hash of the args used to build the configuration. Used in
200-
testing. You probably won't need it.
201+
Returns a hash of the args used to build the configuration. This used to be
202+
used internally, but is now retained simply for backwards compatibility. You
203+
probably won't need it.
201204
202205
=cut
203206

lib/Test/Class/Moose/Deprecated.pm

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use 5.10.0;
1111
our $VERSION = '0.79';
1212

1313
use Package::DeprecationManager 0.16 -deprecations => {
14-
'Test::Class::Moose->runtests' => '0.55',
14+
'Test::Class::Moose::Config::args' => '0.79',
1515
};
1616

1717
1;
@@ -31,16 +31,14 @@ deprecated in L<Test::Class::Moose>.
3131
3232
If you specify C<< -api_version => $version >>, you can use deprecated features
3333
without warnings. Note that this special treatment is limited to the package
34-
that loads C<Moose::Deprecated>.
34+
that loads C<Test::Class::Moose::Deprecated>.
3535
3636
=head1 DEPRECATIONS BY VERSION
3737
3838
The following features were deprecated in past versions and will now warn:
3939
40-
=head2 Test::Class::Moose->runtests
40+
=head2 Test::Class::Moose::Config->args
4141
42-
This was deprecated in version 0.55.
43-
44-
Use L<Test::Class::Moose::Runner> to run tests instead.
42+
This was deprecated in version 0.79.
4543
4644
=cut

lib/Test/Class/Moose/Role/Executor.pm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ sub _run_test_instances {
113113
my $class_report = shift;
114114

115115
my @test_instances = $test_class->_tcm_make_test_class_instances(
116-
$self->test_configuration->args,
117116
test_report => $self->test_report,
118117
);
119118

t/basiclib/TestsFor/Basic.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ sub expected_test_events {
7575
call max => 4;
7676
call trace => object {
7777
call package => 'Test::Class::Moose::Role::Executor';
78-
call line => 152;
78+
call line => 151;
7979
call subname => 'Test::Class::Moose::Util::context_do';
8080
};
8181
};

0 commit comments

Comments
 (0)