Skip to content

Commit

Permalink
feat(core): Deprecate TestBed.get as deprecated
Browse files Browse the repository at this point in the history
From 9.0.0 use TestBed.inject
See #32200

Fixes #26491
  • Loading branch information
Goodwine committed Sep 9, 2019
1 parent bf15d3e commit 14c996e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions packages/core/testing/src/r3_test_bed.ts
Expand Up @@ -162,11 +162,11 @@ export class TestBedRender3 implements TestBed {
return _getTestBedRender3().inject(token, notFoundValue, flags);
}

/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
static get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
static get(token: any, notFoundValue?: any): any;
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
static get(
token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
flags: InjectFlags = InjectFlags.Default): any {
Expand Down Expand Up @@ -271,11 +271,11 @@ export class TestBedRender3 implements TestBed {
return result === UNDEFINED ? this.compiler.injector.get(token, notFoundValue, flags) : result;
}

/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
get(token: any, notFoundValue?: any): any;
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
get(token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
flags: InjectFlags = InjectFlags.Default): any {
return this.inject(token, notFoundValue, flags);
Expand Down
16 changes: 8 additions & 8 deletions packages/core/testing/src/test_bed.ts
Expand Up @@ -62,9 +62,9 @@ export interface TestBed {
token: Type<T>|InjectionToken<T>|AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T
|null;

/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
get(token: any, notFoundValue?: any): any;

execute(tokens: any[], fn: Function, context?: any): any;
Expand Down Expand Up @@ -226,14 +226,14 @@ export class TestBedViewEngine implements TestBed {
return _getTestBedViewEngine().inject(token, notFoundValue, flags);
}

/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
static get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
/**
* TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject
* @deprecated from v9.0.0 use TestBed.inject
* @suppress {duplicate}
*/
static get(token: any, notFoundValue?: any): any;
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
static get(
token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
flags: InjectFlags = InjectFlags.Default): any {
Expand Down Expand Up @@ -483,11 +483,11 @@ export class TestBedViewEngine implements TestBed {
return result === UNDEFINED ? this._compiler.injector.get(token, notFoundValue, flags) : result;
}

/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
get(token: any, notFoundValue?: any): any;
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
get(token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND,
flags: InjectFlags = InjectFlags.Default): any {
return this.inject(token, notFoundValue, flags);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/testing/src/test_bed_common.ts
Expand Up @@ -120,9 +120,9 @@ export interface TestBedStatic {
token: Type<T>|InjectionToken<T>|AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T
|null;

/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
/** TODO(goodwine): Mark as deprecated from v9.0.0 use TestBed.inject */
/** @deprecated from v9.0.0 use TestBed.inject */
get(token: any, notFoundValue?: any): any;

createComponent<T>(component: Type<T>): ComponentFixture<T>;
Expand Down
8 changes: 4 additions & 4 deletions tools/public_api_guard/core/testing.d.ts
Expand Up @@ -58,8 +58,8 @@ export interface TestBed {
configureTestingModule(moduleDef: TestModuleMetadata): void;
createComponent<T>(component: Type<T>): ComponentFixture<T>;
execute(tokens: any[], fn: Function, context?: any): any;
get(token: any, notFoundValue?: any): any;
get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
/** @deprecated */ get(token: any, notFoundValue?: any): any;
/** @deprecated */ get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): void;
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue?: T, flags?: InjectFlags): T;
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T | null;
Expand Down Expand Up @@ -95,8 +95,8 @@ export interface TestBedStatic {
}): TestBedStatic;
configureTestingModule(moduleDef: TestModuleMetadata): TestBedStatic;
createComponent<T>(component: Type<T>): ComponentFixture<T>;
get(token: any, notFoundValue?: any): any;
get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
/** @deprecated */ get(token: any, notFoundValue?: any): any;
/** @deprecated */ get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): TestBed;
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue: null, flags?: InjectFlags): T | null;
inject<T>(token: Type<T> | InjectionToken<T> | AbstractType<T>, notFoundValue?: T, flags?: InjectFlags): T;
Expand Down

0 comments on commit 14c996e

Please sign in to comment.