}); }); }); describe("::reset()", function () { beforeEach(function () { Stub::on('Kahlan\\Spec\\Fixture\\Plugin\\Pointcut\\Foo')->method('foo', function () { }); Stub::on('Kahlan\\Spec\\Fixture\\Plugin\\Pointcut\\Bar')->method('bar', function () { }); }); it("clears all stubs", function () { Stub::reset(); expect(Stub::registered())->toBe([]); }); it("clears one stub", function () { Stub::reset('Kahlan\\Spec\\Fixture\\Plugin\\Pointcut\\Foo'); expect(Stub::registered())->toBe(['Kahlan\\Spec\\Fixture\\Plugin\\Pointcut\\Bar']); }); }); describe("::_generateAbstractMethods()", function () { it("throws an exception when called with a non-existing class", function () { expect(function () { $stub = Stub::classname(['extends' => 'Kahlan\\Plugin\\Stub', 'methods' => ['::generateAbstractMethods']]); Stub::on($stub)->method('::generateAbstractMethods', function ($class) { return static::_generateAbstractMethods($class); }); $stub::generateAbstractMethods('some\\unexisting\\Class'); })->toThrow(new IncompleteException('Unexisting parent class `some\\unexisting\\Class`')); }); }); describe("::create()", function () {
}); }); }); describe("::reset()", function () { beforeEach(function () { Stub::on('kahlan\\spec\\fixture\\plugin\\pointcut\\Foo')->method('foo', function () { }); Stub::on('kahlan\\spec\\fixture\\plugin\\pointcut\\Bar')->method('bar', function () { }); }); it("clears all stubs", function () { Stub::reset(); expect(Stub::registered())->toBe([]); }); it("clears one stub", function () { Stub::reset('kahlan\\spec\\fixture\\plugin\\pointcut\\Foo'); expect(Stub::registered())->toBe(['kahlan\\spec\\fixture\\plugin\\pointcut\\Bar']); }); }); describe("::_generateAbstractMethods()", function () { it("throws an exception when called with a non-existing class", function () { expect(function () { $stub = Stub::classname(['extends' => 'kahlan\\plugin\\Stub', 'methods' => ['::generateAbstractMethods']]); Stub::on($stub)->method('::generateAbstractMethods', function ($class) { return static::_generateAbstractMethods($class); }); $stub::generateAbstractMethods('some\\unexisting\\Class'); })->toThrow(new IncompleteException('Unexisting parent class `some\\unexisting\\Class`')); }); }); describe("::create()", function () {