本文整理汇总了PHP中make_container函数的典型用法代码示例。如果您正苦于以下问题:PHP make_container函数的具体用法?PHP make_container怎么用?PHP make_container使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_container函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testLoginToFacebook
public function testLoginToFacebook()
{
$this->markTestSkipped();
// preconditions: #1 php web server being run
$browserModule = new PhpBrowser(make_container());
$browserModule->_setConfig(array('url' => 'http://localhost:8000'));
$browserModule->_initialize();
$browserModule->_cleanup();
$browserModule->_before($this->makeTest());
SuiteManager::$modules['PhpBrowser'] = $browserModule;
// preconditions: #2 facebook test user was created
$this->module->haveFacebookTestUserAccount();
$testUserName = $this->module->grabFacebookTestUserName();
// preconditions: #3 test user logged in on facebook
$this->module->haveTestUserLoggedInOnFacebook();
// go to our page with facebook login button
$browserModule->amOnPage('/facebook');
// check that yet we are not logged in with facebook
$browserModule->see('You are not Connected.');
// click on "Login with Facebook" button to start login with facebook
$browserModule->click('Login with Facebook');
// check that we are logged in with facebook
$browserModule->see('Your User Object (/me)');
$browserModule->see($testUserName);
// cleanup
unset(SuiteManager::$modules['PhpBrowser']);
$browserModule->_after($this->makeTest());
data::clean();
}
开发者ID:hitechdk,项目名称:Codeception,代码行数:29,代码来源:FacebookTest.php
示例2: testExceptionFails
/**
* @expectedException PHPUnit_Framework_AssertionFailedError
*/
public function testExceptionFails()
{
$module = new \Codeception\Module\Asserts(make_container());
$module->expectException(new Exception('here', 200), function () {
throw new Exception('here', 2);
});
}
开发者ID:solutionDrive,项目名称:Codeception,代码行数:10,代码来源:AssertsTest.php
示例3: testAsserts
public function testAsserts()
{
$module = new \Codeception\Module\Asserts(make_container());
$module->assertEquals(1, 1);
$module->assertContains(1, [1, 2]);
$module->assertSame(1, 1);
$module->assertNotSame(1, true);
}
开发者ID:namnv609,项目名称:Codeception,代码行数:8,代码来源:AssertsTest.php
示例4: setUp
public function setUp()
{
$this->module = new \Codeception\Module\SOAP(make_container());
$this->module->_setConfig(array('schema' => 'http://www.w3.org/2001/xml.xsd', 'endpoint' => 'http://codeception.com/api/wsdl'));
$this->layout = \Codeception\Configuration::dataDir() . '/xml/layout.xml';
$this->module->isFunctional = true;
$this->module->_before(Stub::makeEmpty('\\Codeception\\Test\\Test'));
$this->module->client = Stub::makeEmpty('\\Codeception\\Lib\\Connector\\Universal');
}
开发者ID:foxman209,项目名称:Codeception,代码行数:9,代码来源:SoapTest.php
示例5: testCreateSnapshotOnFail
public function testCreateSnapshotOnFail()
{
$module = Stub::construct(get_class($this->module), [make_container()], ['_savePageSource' => Stub::once(function ($filename) {
$this->assertEquals(codecept_log_dir('Codeception.Module.UniversalFramework.looks.like..test.fail.html'), $filename);
})]);
$module->amOnPage('/');
$cest = new \Codeception\Test\Cest($this->module, 'looks:like::test', 'demo1Cest.php');
$module->_failed($cest, new PHPUnit_Framework_AssertionFailedError());
}
开发者ID:solutionDrive,项目名称:Codeception,代码行数:9,代码来源:FrameworksTest.php
示例6: testSequences
public function testSequences()
{
$module = new \Codeception\Module\Sequence(make_container());
$this->assertNotEquals(sq(), sq());
$this->assertNotEquals(sq(1), sq(2));
$this->assertEquals(sq(1), sq(1));
$old = sq(1);
$module->_after($this);
$this->assertNotEquals($old, sq(1));
}
开发者ID:foxman209,项目名称:Codeception,代码行数:10,代码来源:SequenceTest.php
示例7: testAsserts
public function testAsserts()
{
$module = new \Codeception\Module\Asserts(make_container());
$module->assertEquals(1, 1);
$module->assertContains(1, [1, 2]);
$module->assertSame(1, 1);
$module->assertNotSame(1, true);
$module->assertRegExp('/^[\\d]$/', '1');
$module->assertNotRegExp('/^[a-z]$/', '1');
}
开发者ID:azonwan,项目名称:pingju,代码行数:10,代码来源:AssertsTest.php
示例8: setUp
public function setUp()
{
$this->noPhpWebserver();
$this->noSelenium();
$this->module = new \Codeception\Module\WebDriver(make_container());
$url = 'http://localhost:8000';
$this->module->_setConfig(['url' => $url, 'browser' => 'firefox', 'port' => '4444', 'restart' => true, 'wait' => 0]);
$this->module->_initialize();
$this->module->_before($this->makeTest());
$this->webDriver = $this->module->webDriver;
}
开发者ID:Marfuz,项目名称:c4t_test,代码行数:11,代码来源:WebDriverTest.php
示例9: setUp
public function setUp()
{
$this->module = new \Codeception\Module\Queue(make_container());
$this->module->_setConfig($this->config);
$this->module->_before(Stub::makeEmpty('\\Codeception\\TestCase'));
try {
$this->module->clearQueue('default');
} catch (\Pheanstalk_Exception_ConnectionException $e) {
$this->markTestSkipped("Beanstalk is not running");
}
}
开发者ID:foxman209,项目名称:Codeception,代码行数:11,代码来源:Beanstalkd_Test.php
示例10: setUp
public function setUp()
{
$this->module = new \Codeception\Module\AMQP(make_container());
$this->module->_setConfig($this->config);
$res = stream_socket_client('tcp://localhost:5672');
if ($res === false) {
$this->markTestSkipped('AMQP is not running');
}
$this->module->_initialize();
$connection = $this->module->connection;
$connection->channel()->queue_declare('queue1');
}
开发者ID:solutionDrive,项目名称:Codeception,代码行数:12,代码来源:AMQPTest.php
示例11: setUp
public function setUp()
{
$this->phpBrowser = new \Codeception\Module\PhpBrowser(make_container());
$url = 'http://localhost:8010';
$this->phpBrowser->_setConfig(array('url' => $url));
$this->phpBrowser->_initialize();
$this->module = Stub::make('\\Codeception\\Module\\REST');
$this->module->_inject($this->phpBrowser);
$this->module->_initialize();
$this->module->_before(Stub::makeEmpty('\\Codeception\\TestCase\\Cest'));
$this->phpBrowser->_before(Stub::makeEmpty('\\Codeception\\TestCase\\Cest'));
}
开发者ID:nsgomez,项目名称:Codeception,代码行数:12,代码来源:PhpBrowserRestTest.php
示例12: setUp
public function setUp()
{
$connector = new \Codeception\Lib\Connector\Universal();
$connector->setIndex(\Codeception\Configuration::dataDir() . '/rest/index.php');
$connectionModule = new \Codeception\Module\PhpBrowser(make_container());
$this->module = Stub::make('\\Codeception\\Module\\REST');
$this->module->_inject($connectionModule);
$this->module->_initialize();
$this->module->_before(Stub::makeEmpty('\\Codeception\\TestCase\\Cest'));
$this->module->client = $connector;
$this->module->client->setServerParameters(['SCRIPT_FILENAME' => 'index.php', 'SCRIPT_NAME' => 'index', 'SERVER_NAME' => 'localhost', 'SERVER_PROTOCOL' => 'http']);
}
开发者ID:codeception,项目名称:base,代码行数:12,代码来源:RestTest.php
示例13: setUpBeforeClass
public static function setUpBeforeClass()
{
self::$module = new \Codeception\Module\Db(make_container());
self::$module->_setConfig(self::$config);
self::$module->_initialize();
$sqlite = self::$module->driver;
$sqlite->cleanup();
$sql = file_get_contents(\Codeception\Configuration::dataDir() . '/dumps/sqlite.sql');
$sql = preg_replace('%/\\*(?:(?!\\*/).)*\\*/%s', "", $sql);
$sql = explode("\n", $sql);
$sqlite->load($sql);
}
开发者ID:hitechdk,项目名称:Codeception,代码行数:12,代码来源:DbTest.php
示例14: setUp
protected function setUp()
{
if (!class_exists('Mongo')) {
$this->markTestSkipped('Mongo is not installed');
}
$mongo = new \MongoClient();
$this->module = new MongoDb(make_container());
$this->module->_setConfig($this->mongoConfig);
$this->module->_initialize();
$this->db = $mongo->selectDB('test');
$this->userCollection = $this->db->createCollection('users');
$this->userCollection->insert(array('id' => 1, 'email' => '[email protected]'));
}
开发者ID:hitechdk,项目名称:Codeception,代码行数:13,代码来源:MongoDbTest.php
示例15: setUp
public function setUp()
{
$this->testCase = Stub::make('\\Codeception\\TestCase');
$module = new \Codeception\Module\Dbh(make_container());
try {
$driver = Driver::create($this->config['dsn'], $this->config['user'], $this->config['password']);
$module::$dbh = $driver->getDbh();
} catch (\PDOException $e) {
$this->markTestSkipped('Coudn\'t establish connection to database');
return;
}
$this->module = $module;
}
开发者ID:hitechdk,项目名称:Codeception,代码行数:13,代码来源:DbhTest.php
示例16: setUp
protected function setUp()
{
$this->module = new \Codeception\Module\PhpBrowser(make_container());
$url = 'http://localhost:8000';
$this->module->_setConfig(array('url' => $url));
$this->module->_initialize();
$this->module->_cleanup();
$this->module->_before($this->makeTest());
if (class_exists('GuzzleHttp\\Url')) {
$this->history = new \GuzzleHttp\Subscriber\History();
$this->module->guzzle->getEmitter()->attach($this->history);
} else {
$this->module->guzzle->getConfig('handler')->push(\GuzzleHttp\Middleware::history($this->history));
}
}
开发者ID:jpmanne,项目名称:twm-funcTests,代码行数:15,代码来源:PhpBrowserTest.php
示例17: setUp
protected function setUp()
{
if (!class_exists('\\MongoDB\\Client')) {
$this->markTestSkipped('MongoDB is not installed');
}
$mongo = new \MongoDB\Client();
$this->module = new MongoDb(make_container());
$this->module->_setConfig($this->mongoConfig);
try {
$this->module->_initialize();
} catch (ModuleException $e) {
$this->markTestSkipped($e->getMessage());
}
$this->db = $mongo->selectDatabase('test');
$this->userCollection = $this->db->users;
$this->userCollection->insertOne(array('id' => 1, 'email' => '[email protected]'));
}
开发者ID:solutionDrive,项目名称:Codeception,代码行数:17,代码来源:MongoDbTest.php
示例18: testAsserts
public function testAsserts()
{
$module = new \Codeception\Module\Asserts(make_container());
$module->assertEquals(1, 1);
$module->assertContains(1, [1, 2]);
$module->assertSame(1, 1);
$module->assertNotSame(1, true);
$module->assertRegExp('/^[\\d]$/', '1');
$module->assertNotRegExp('/^[a-z]$/', '1');
$module->assertEmpty([]);
$module->assertNotEmpty([1]);
$module->assertNull(null);
$module->assertNotNull('');
$module->assertNotNull(false);
$module->assertNotNull(0);
$module->assertTrue(true);
$module->assertFalse(false);
$module->assertFileExists(__FILE__);
$module->assertFileNotExists(__FILE__ . '.notExist');
}
开发者ID:hitechdk,项目名称:Codeception,代码行数:20,代码来源:AssertsTest.php
示例19: setUp
/**
* {@inheritdoc}
*
* Every time a test starts, cleanup the database and populates it with some
* dummy data.
*/
protected function setUp()
{
if (!class_exists('Predis\\Client')) {
$this->markTestSkipped('Predis is not installed');
}
/** @var ModuleContainer $container */
$container = make_container();
try {
$this->module = new Redis($container);
$this->module->_setConfig(self::$config);
$this->module->_initialize();
$this->module->driver->flushDb();
} catch (Predis\Connection\ConnectionException $e) {
$this->markTestSkipped($e->getMessage());
}
$addMethods = ['string' => 'set', 'list' => 'rPush', 'set' => 'sAdd', 'zset' => 'zAdd', 'hash' => 'hMSet'];
foreach (self::$keys as $type => $key) {
$this->module->driver->{$addMethods[$type]}($key['name'], $key['value']);
}
}
开发者ID:solutionDrive,项目名称:Codeception,代码行数:26,代码来源:RedisTest.php
示例20: setUp
public function setUp()
{
$this->module = new \Codeception\Module\FTP(make_container());
$this->module->_setConfig($this->config);
$this->module->_before(Stub::make('\\Codeception\\TestCase'));
}
开发者ID:solutionDrive,项目名称:Codeception,代码行数:6,代码来源:SFTPTest.php
注:本文中的make_container函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论