本文整理汇总了PHP中make_container函数的典型用法代码示例。如果您正苦于以下问题:PHP make_container函数的具体用法?PHP make_container怎么用?PHP make_container使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_container函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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);
});
}
示例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);
}
示例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');
}
示例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());
}
示例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));
}
示例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');
}
示例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;
}
示例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");
}
}
示例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');
}
示例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'));
}
示例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']);
}
示例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);
}
示例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' => 'miles@davis.com'));
}
示例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;
}