class ZfExtensionManagerSfContainerTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Component/Bridge/ZfExtensionManagerSfContainerTest.php \Drupal\Tests\Component\Bridge\ZfExtensionManagerSfContainerTest
@coversDefaultClass \Drupal\Component\Bridge\ZfExtensionManagerSfContainer @group Bridge
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \Drupal\Tests\PHPUnit_Framework_TestCase
- class \Drupal\Tests\Component\Bridge\ZfExtensionManagerSfContainerTest
Expanded class hierarchy of ZfExtensionManagerSfContainerTest
File
- core/
tests/ Drupal/ Tests/ Component/ Bridge/ ZfExtensionManagerSfContainerTest.php, line 18 - Contains \Drupal\Tests\Component\Bridge\ZfExtensionManagerSfContainerTest.
Namespace
Drupal\Tests\Component\BridgeView source
class ZfExtensionManagerSfContainerTest extends UnitTestCase {
/**
* @covers ::setContainer
* @covers ::get
*/
public function testGet() {
$service = new \stdClass();
$service->value = 'myvalue';
$container = new ContainerBuilder();
$container
->set('foo', $service);
$bridge = new ZfExtensionManagerSfContainer();
$bridge
->setContainer($container);
$this
->assertEquals($service, $bridge
->get('foo'));
}
/**
* @covers ::setContainer
* @covers ::has
*/
public function testHas() {
$service = new \stdClass();
$service->value = 'myvalue';
$container = new ContainerBuilder();
$container
->set('foo', $service);
$bridge = new ZfExtensionManagerSfContainer();
$bridge
->setContainer($container);
$this
->assertTrue($bridge
->has('foo'));
$this
->assertFalse($bridge
->has('bar'));
}
/**
* @covers ::__construct
* @covers ::has
* @covers ::get
*/
public function testPrefix() {
$service = new \stdClass();
$service->value = 'myvalue';
$container = new ContainerBuilder();
$container
->set('foo.bar', $service);
$bridge = new ZfExtensionManagerSfContainer('foo.');
$bridge
->setContainer($container);
$this
->assertTrue($bridge
->has('bar'));
$this
->assertFalse($bridge
->has('baz'));
$this
->assertEquals($service, $bridge
->get('bar'));
}
/**
* @covers ::canonicalizeName
* @dataProvider canonicalizeNameProvider
*/
public function testCanonicalizeName($name, $canonical_name) {
$service = new \stdClass();
$service->value = 'myvalue';
$container = new ContainerBuilder();
$container
->set($canonical_name, $service);
$bridge = new ZfExtensionManagerSfContainer();
$bridge
->setContainer($container);
$this
->assertTrue($bridge
->has($name));
$this
->assertEquals($service, $bridge
->get($name));
}
/**
* Data provider for testReverseProxyEnabled.
*
* Replacements:
* array('-' => '', '_' => '', ' ' => '', '\\' => '', '/' => '')
*/
public function canonicalizeNameProvider() {
return array(
array(
'foobar',
'foobar',
),
array(
'foo-bar',
'foobar',
),
array(
'foo_bar',
'foobar',
),
array(
'foo bar',
'foobar',
),
array(
'foo\\bar',
'foobar',
),
array(
'foo/bar',
'foobar',
),
// There is also a strtolower in canonicalizeName.
array(
'Foo/bAr',
'foobar',
),
array(
'foo/-_\\ bar',
'foobar',
),
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed in array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnitTestCase:: |
protected | function | 259 | |
ZfExtensionManagerSfContainerTest:: |
public | function | Data provider for testReverseProxyEnabled. | |
ZfExtensionManagerSfContainerTest:: |
public | function | @covers ::canonicalizeName @dataProvider canonicalizeNameProvider | |
ZfExtensionManagerSfContainerTest:: |
public | function | @covers ::setContainer @covers ::get | |
ZfExtensionManagerSfContainerTest:: |
public | function | @covers ::setContainer @covers ::has | |
ZfExtensionManagerSfContainerTest:: |
public | function | @covers ::__construct @covers ::has @covers ::get |