Skip to content

Commit 05c61df

Browse files
committed
removed test::ns method
1 parent 98de15a commit 05c61df

5 files changed

Lines changed: 3 additions & 83 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#### 0.5.0
44

5+
* test::ns() method removed *2014-10-10*
56
* Mocking functions implemented with test::func method *2014-10-10*
67
* Fixed mocking functions with arguments passed by reference #34 by @tampe125 *2014-10-09*
7-
* Fixed mocking functions with arguments passed by reference #34 by @tampe125 *2014-10-08*
88
* Fixed passing arguments by reference in InstanceProxy. Thanks to @tampe125. Issue #39 *2014-10-08*
99
* Debug mode can be disabled in options with debug => false *2014-10-08*
1010
* Updated to Go\Aop 0.5.0
@@ -18,10 +18,7 @@
1818

1919
* depdendency on AspectMock ~0.4.0
2020

21-
22-
2321
#### 0.4.1
24-
02/25/2014
2522

2623
* RoboFile
2724
* Verify invocation arguments with closures @gchaincl

docs/Test.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -160,23 +160,6 @@ test::methods($user, []);
160160
* return Core\ClassProxy|Core\InstanceProxy
161161
* throws \Exception
162162

163-
#### *public static* ns($namespace)
164-
Adds a namespace / namespaces for classes to be searched.
165-
Useful if you have long namespaces and classes there.
166-
167-
``` php
168-
<?php
169-
test::ns('Company\App\ProjectBundle');
170-
test::double('Entity\User'); // => Company\App\ProjectBundle\Entity\User
171-
172-
?>
173-
```
174-
Using `ns` helps in refactoring: test doubles do not depend on long class names.
175-
176-
When declared in `test::double` not exists, AspectMock will try to match it by prepending a namespace.
177-
To ignore namespace guessing, use `\` in the beginning of class name: `\User`;
178-
179-
180163
#### *public static* func($namespace, $function, $body)
181164
Replaces function in provided namespace with user-defined function or value that function returns;
182165
Function is restored to original on cleanup.

src/AspectMock/Core/Registry.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class Registry {
1414
protected static $classCalls = [];
1515
protected static $instanceCalls = [];
1616
protected static $funcCalls = [];
17-
protected static $ns = '';
1817

1918
/**
2019
* @var Mocker
@@ -68,7 +67,6 @@ static function clean($classOrInstance = null)
6867
unset(self::$classCalls[$classOrInstance]);
6968

7069
} else {
71-
self::$ns = '';
7270
self::cleanInvocations();
7371
}
7472
}
@@ -125,14 +123,4 @@ public static function setMocker(Mocker $mocker)
125123
self::$mocker = $mocker;
126124
}
127125

128-
public static function setNamespace($namespace)
129-
{
130-
self::$ns = $namespace;
131-
}
132-
133-
public static function getNamespace()
134-
{
135-
return self::$ns;
136-
}
137-
138126
}

src/AspectMock/Test.php

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -214,28 +214,6 @@ public static function methods($classOrObject, array $only = array())
214214
return self::double($classOrObject, $params);
215215
}
216216

217-
/**
218-
* Adds a namespace / namespaces for classes to be searched.
219-
* Useful if you have long namespaces and classes there.
220-
*
221-
* ``` php
222-
* <?php
223-
* test::ns('Company\App\ProjectBundle');
224-
* test::double('Entity\User'); // => Company\App\ProjectBundle\Entity\User
225-
*
226-
* ?>
227-
* ```
228-
* Using `ns` helps in refactoring: test doubles do not depend on long class names.
229-
*
230-
* When declared in `test::double` not exists, AspectMock will try to match it by prepending a namespace.
231-
* To ignore namespace guessing, use `\` in the beginning of class name: `\User`;
232-
*
233-
*/
234-
public static function ns($namespace)
235-
{
236-
Registry::setNamespace($namespace);
237-
}
238-
239217
/**
240218
* Replaces function in provided namespace with user-defined function or value that function returns;
241219
* Function is restored to original on cleanup.
@@ -305,7 +283,8 @@ public static function clean($classOrInstance = null)
305283
}
306284

307285
/*
308-
* Clears mock verifications, but not stub definitions.
286+
* Clears mock verifications but not stub definitions.
287+
*
309288
*
310289
* @api
311290
*/
@@ -316,11 +295,3 @@ public static function cleanInvocations()
316295

317296

318297
}
319-
320-
function class_exists($class_name)
321-
{
322-
if (\class_exists($class_name)) return true;
323-
if (strpos($class_name, '\\') === 0) return false;
324-
return \class_exists(Registry::getNamespace() .'\\'.$class_name);
325-
326-
}

tests/unit/NamespacesTest.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)