Related
I try to create tags if not exist by using select2 entity. When I try to add a tag that contains spaces I can't.
For example :
"Yupi yola" --> not work because tag contains spaces, is getting only first word "Yupi".
"Test" ---> work
"Test_test" ---> work
I added the Select2Entity in my form type
->add('groupe', Select2EntityType::class, [
'remote_route' => 'route',
'class' => Class::class,
'primary_key' => 'id',
'text_property' => 'name',
'minimum_input_length' => 2,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => true,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'en',
'placeholder' => 'Select a group',
'allow_add' => array(
'enabled' => true,
'new_tag_text' => '',
'tokenSeparators'=> '[",", " "]'
),
'multiple' => false,
'attr' => ['style' => 'width:100%'],
'scroll' => true,
])
Please help me. Thx in advance.
Instead of 'tokenSeparators', use 'tag_separators'
'allow_add' => array(
'enabled' => true,
'new_tag_text' => '',
'new_tag_prefix' => '__',
'tag_separators'=> '[",", " "]'
)
I have a Symfony2 endpoint that needs to accept a post request with a few text parameters and a zip file delivered by a 3rd party program. For quick development I started out by just using a Chrome POST plugin to spoof sending the form data. I was able to retrieve the file just fine when using that method.
However, when I switched to the 3rd party Windows application for uploading reports, I'm no longer able to retrieve the file. Instead of figuring out that it's a zip file, I now get mimeType' => 'application/octet-stream', and the file size is 0.
I read here in the following link that I needed to make sure my post_max_size and upload_max_filesize were large enough to handle the file. Can't upload image with mime-type "application/octet-stream" in Symfony2
I didn't want to mess around, so I set it to 100mb, but still no luck.
Here is a dump of the Request:
[2016-08-24 10:15:48] app.INFO: Request dump: Symfony\Component\HttpFoundation\Request::__set_state(array( 'attributes' => Symfony\Component\HttpFoundation\ParameterBag::__set_state(array( 'parameters' => array ( '_format' => 'xml', '_controller' => 'Company\\Bundle\\CompanyBundle\\Controller\\DefaultController::cloudTransferReport', '_route' => 'hg_cloudtransfer_report', '_route_params' => array ( '_format' => 'xml', ), '_method' => Sensio\Bundle\FrameworkExtraBundle\Configuration\Method::__set_state(array( 'methods' => array ( 0 => 'POST', 1 => 'GET', ), )), ), )), 'request' => Symfony\Component\HttpFoundation\ParameterBag::__set_state(array( 'parameters' => array ( 'submitter' => 'hgis', 'version' => '5.1.26.0', 'userName' => 'admin', 'password' => 'kitten', ), )), 'query' => Symfony\Component\HttpFoundation\ParameterBag::__set_state(array( 'parameters' => array ( ), )), 'server' => Symfony\Component\HttpFoundation\ServerBag::__set_state(array( 'parameters' => array ( 'REDIRECT_HTTPS' => 'on', 'REDIRECT_SSL_TLS_SNI' => 'example.com', 'REDIRECT_STATUS' => '200', 'HTTPS' => 'on', 'SSL_TLS_SNI' => 'example.com', 'CONTENT_TYPE' => 'multipart/form-data, boundary=AaBbCcDdHhGg40', 'HTTP_USER_AGENT' => 'Some software v 5.1.26.0', 'HTTP_HOST' => 'example.com', 'CONTENT_LENGTH' => '3592731', 'HTTP_CACHE_CONTROL' => 'no-cache', 'PATH' => '/usr/bin:/bin:/usr/sbin:/sbin', 'SERVER_SIGNATURE' => '', 'SERVER_SOFTWARE' => 'Apache/2.4.18 (Unix) PHP/5.5.36 LibreSSL/2.2.7', 'SERVER_NAME' => 'example.com', 'SERVER_ADDR' => '192.168.1.100', 'SERVER_PORT' => '443', 'REMOTE_ADDR' => '192.168.1.223', 'DOCUMENT_ROOT' => '/Users/user/Documents/symphony/cpsrecall/web', 'REQUEST_SCHEME' => 'https', 'CONTEXT_PREFIX' => '', 'CONTEXT_DOCUMENT_ROOT' => '/Users/user/Documents/symphony/cpsrecall/web', 'SERVER_ADMIN' => 'chris#yourcontactpoint.com', 'SCRIPT_FILENAME' => '/Users/user/Documents/symphony/cpsrecall/web/app.php', 'REMOTE_PORT' => '51248', 'REDIRECT_URL' => '/hg/cloudtransfer/upload-report', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'REQUEST_METHOD' => 'POST', 'QUERY_STRING' => '', 'REQUEST_URI' => '/hg/cloudtransfer/upload-report', 'SCRIPT_NAME' => '/app.php', 'PHP_SELF' => '/app.php', 'REQUEST_TIME_FLOAT' => 1472055346.6129999, 'REQUEST_TIME' => 1472055346, ), )), 'files' => Symfony\Component\HttpFoundation\FileBag::__set_state(array( 'parameters' => array ( 'file1' => Symfony\Component\HttpFoundation\File\UploadedFile::__set_state(array( 'test' => false, 'originalName' => '00000003-1.zip', 'mimeType' => 'application/octet-stream', 'size' => 0, 'error' => 1, )), ), )), 'cookies' => Symfony\Component\HttpFoundation\ParameterBag::__set_state(array( 'parameters' => array ( ), )), 'headers' => Symfony\Component\HttpFoundation\HeaderBag::__set_state(array( 'headers' => array ( 'content-type' => array ( 0 => 'multipart/form-data, boundary=AaBbCcDdHhGg40', ), 'user-agent' => array ( 0 => 'Some software v 5.1.26.0', ), 'host' => array ( 0 => 'example.com', ), 'content-length' => array ( 0 => '3592731', ), 'cache-control' => array ( 0 => 'no-cache', ), 'x-php-ob-level' => array ( 0 => 1, ), ), 'cacheControl' => array ( 'no-cache' => true, ), )), 'content' => '', 'languages' => NULL, 'charsets' => NULL, 'encodings' => NULL, 'acceptableContentTypes' => NULL, 'pathInfo' => '/hg/cloudtransfer/upload-report', 'requestUri' => '/hg/cloudtransfer/upload-report', 'baseUrl' => '', 'basePath' => NULL, 'method' => 'POST', 'format' => NULL, 'session' => Symfony\Component\HttpFoundation\Session\Session::__set_state(array( 'storage' => Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage::__set_state(array( 'bags' => array ( 'attributes' => Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag::__set_state(array( 'name' => 'attributes', 'storageKey' => '_sf2_attributes', 'attributes' => array ( ), )), 'flashes' => Symfony\Component\HttpFoundation\Session\Flash\FlashBag::__set_state(array( 'name' => 'flashes', 'flashes' => array ( ), 'storageKey' => '_sf2_flashes', )), ), 'started' => false, 'closed' => false, 'saveHandler' => Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy::__set_state(array( 'handler' => SessionHandler::__set_state(array( )), 'wrapper' => true, 'active' => false, 'saveHandlerName' => 'files', )), 'metadataBag' => Symfony\Component\HttpFoundation\Session\Storage\MetadataBag::__set_state(array( 'name' => '__metadata', 'storageKey' => '_sf2_meta', 'meta' => array ( 'c' => 0, 'u' => 0, 'l' => 0, ), 'lastUsed' => NULL, 'updateThreshold' => '0', )), )), 'flashName' => 'flashes', 'attributeName' => 'attributes', )), 'locale' => NULL, 'defaultLocale' => 'en', )) [] []
and for those who don't want to read that big long line, here's just the FileBag:
[2016-08-24 10:15:48] app.INFO: file1dump: Symfony\Component\HttpFoundation\File\UploadedFile::__set_state(array( 'test' => false, 'originalName' => '00000003-1.zip', 'mimeType' => 'application/octet-stream', 'size' => 0, 'error' => 1, )) [] []
Here is my code up that should grab the file, but perhaps I'm going about it wrong:
public function cloudTransferReport(Request $request)
{
$logger = $this->get('logger');
$em = $this->getDoctrine()->getManager();
$data = $request->request;
$files = $request->files;
$submitter = $data->get('submitter');
$version = $data->get('version');
$memberName = $data->get('userName');
$password = $data->get('password');
$file1 = $files->get('file1');
$logger->info("file string: " . var_export($stuff, true));
$logger->info("file1dump: " . var_export($file1, true));
If you need more code from that controller let me know, but I thought I should at least be able to have the file in memory at this point.
Ok Mac users who run into an issue like this, especially those who have used homebrew, and may or may not have more than one version of PHP installed.
You may have more than one php.ini file on your computer. I ran the php --ini, and it came up with Loaded Configuration File: /usr/local/etc/php/5.6/php.ini. IT WAS WRONG!
Ends up the real php.ini file that Apache was using was in /etc/php.ini, so please, please, please don't waste a whole day banging your head against the keyboard. Make sure you're in the file that Apache is actually using! That is all. I'm going to crawl under my desk and cry now.
I've got this very simple acceptance test using Codeception and its Symfony2 module:
public function myTest(AcceptanceTester $I)
{
$I->wantTo('test something');
$I->amOnRoute("acme_site_home.es");
$I->dontSee('hello');
}
When I run it I get an Undefined index: localhost PHPUnit_Framework_Exception triggered by a call to $request->server->get("HTTP_HOST") in my route action.
I already tried the following:
Adding this to phpunit.xml:
<phpunit>
<php>
<server name='HTTP_HOST' value='http://some.host.com' />
</php>
</phpunit>
Adding this to my test:
$_SERVER['HOST_NAME'] = "some.host.com";
Adding this to my test:
$_SERVER['HTTP_HOST'] = "some.host.com";
None of this works, I always get the same error message.
How could I fix this?
Notes
[everything given here is sanitized (passwords, hostnames, etc.) and some line breaks and indentation were added for readability]
Just in case, my acceptance suite settings are as follows:
class_name: AcceptanceTester
modules:
enabled:
- Asserts
- Db
- Symfony2
- Doctrine2
- \Tests\Helper\Acceptance
And my Codeception settings:
namespace: Tests
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled: [ Codeception\Extension\RunFailed ]
modules:
config:
Db:
dsn: 'mysql:host=localhost;dbname=acme_test'
user: 'root'
password: 'blahblah'
dump: 'tests/_data/dump.sql'
populate: false
cleanup: false
Doctrine2:
depends: Symfony2
cleanup: false
PhpBrowser:
url: http://acme.com
WebDriver:
browser: firefox
url: http://acme.com
REST:
depends: Symfony2
url: http://acme.com
Here is the result of running the test with the -vvv flag:
$ bin/codecept run tests/acceptance/ExtranetBundle/Controller/DefaultControllerCest.php -vvv
Codeception PHP Testing Framework v2.1.3
Powered by PHPUnit 4.8.13 by Sebastian Bergmann and contributors.
Tests.acceptance Tests (1) ---------------------------------------------------------------------------------------------------------------------------
Modules: Asserts, Db, Symfony2, Doctrine2, \Tests\Helper\Acceptance
------------------------------------------------------------------------------------------------------------------------------------------------------
Test something (Acceptance\ExtranetBundle\Controller\DefaultControllerCest::myTest)
Scenario:
* I am on route "acme_site_home.es"
[Page] http://localhost/es
[User] anon. []
* I don't see "hello"
FAIL
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 4.13 seconds, Memory: 65.75Mb
There was 1 failure:
---------
1) Failed to test something in Tests\Acceptance\ExtranetBundle\Controller\DefaultControllerCest::myTest (tests/acceptance/ExtranetBundle/Controller/DefaultControllerCest.php)
Step I don't see "hello"
Fail Failed asserting that /es
-->
Undefined index: localhost (500 Internal Server Error)
[Content too long to display. See complete response in '_output' directory]
--> does not contain "hello".
Scenario Steps:
2. $I->dontSee("hello") at tests/acceptance/ExtranetBundle/Controller/DefaultControllerCest.php:15
1. $I->amOnRoute("acme_site_home.es") at tests/acceptance/ExtranetBundle/Controller/DefaultControllerCest.php:14
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/Constraint/Not.php:100
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/Assert.php:2255
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Util/Shared/Asserts.php:280
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Lib/InnerBrowser.php:1263
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Lib/InnerBrowser.php:284
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Step.php:193
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/TestCase/Shared/Actor.php:99
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Scenario.php:101
/Volumes/Utilisateurs/marc/Sites/acme.com/tests/_support/_generated/AcceptanceTesterActions.php:831
/Volumes/Utilisateurs/marc/Sites/acme.com/tests/acceptance/ExtranetBundle/Controller/DefaultControllerCest.php:15
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Lib/Di.php:112
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/TestCase/Cest.php:127
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/TestCase/Cest.php:136
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/TestCase/Cest.php:66
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/TestCase.php:909
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/TestCase.php:768
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/TestResult.php:612
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/TestCase.php:724
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/TestSuite.php:747
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/PHPUnit/Runner.php:89
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/SuiteManager.php:153
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Codecept.php:203
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Codecept.php:172
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Command/Run.php:184
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:259
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:878
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:195
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:126
/Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/codecept:28
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
And here is the error stack trace given by Symfony in the _output directory:
PHPUnit_Framework_Exception: Undefined index: localhost
at n/a
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Subscriber/ErrorHandler.php line 48
at Codeception\Subscriber\ErrorHandler->errorHandler('8', 'Undefined index: localhost', '/Volumes/Utilisateurs/marc/Sites/acme.com/src/Acme/SiteBundle/Controller/DefaultController.php', '160', array(
'request' => object(Request),
'locale' => 'es',
'registrationForm' => object(Form),
'typeAppFb' => array(
'acme.com' => array(
'appId' => '123456789123456',
'secret' => '123456789abcdef123456789abcdef12'
),
'dev.acme.com' => array(
'appId' => '123456789123456',
'secret' => '123456789abcdef123456789abcdef12'
),
'www.prod-acme.com' => array(
'appId' => '123456789123456',
'secret' => '123456789abcdef123456789abcdef12'
)
)
))
in /Volumes/Utilisateurs/marc/Sites/acme.com/src/Acme/SiteBundle/Controller/DefaultController.php line 160
at Acme\SiteBundle\Controller\DefaultController->homeAction(object(Request))
in line
at call_user_func_array(array(object(DefaultController), 'homeAction'), array(object(Request)))
in /Volumes/Utilisateurs/marc/Sites/acme.com/app/bootstrap.php.cache line 3109
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in /Volumes/Utilisateurs/marc/Sites/acme.com/app/bootstrap.php.cache line 3071
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in /Volumes/Utilisateurs/marc/Sites/acme.com/app/bootstrap.php.cache line 3222
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in /Volumes/Utilisateurs/marc/Sites/acme.com/app/bootstrap.php.cache line 2444
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Client.php line 81
at Symfony\Component\HttpKernel\Client->doRequest(object(Request))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Lib/Connector/Symfony2.php line 38
at Codeception\Lib\Connector\Symfony2->doRequest(object(Request))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Client.php line 327
at Symfony\Component\BrowserKit\Client->request('GET', '/es', array(), array(), array(), null, true)
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Lib/InnerBrowser.php line 130
at Codeception\Lib\InnerBrowser->clientRequest('GET', '/es', array(), array(), array(), null)
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Lib/InnerBrowser.php line 159
at Codeception\Lib\InnerBrowser->_loadPage('GET', '/es')
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Lib/InnerBrowser.php line 203
at Codeception\Lib\InnerBrowser->amOnPage('/es')
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Module/Symfony2.php line 197
at Codeception\Module\Symfony2->amOnRoute('acme_site_home.es')
in line
at call_user_func_array(array(object(Symfony2), 'amOnRoute'), array('acme_site_home.es'))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Step.php line 193
at Codeception\Step->run(object(ModuleContainer))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/TestCase/Shared/Actor.php line 99
at Codeception\TestCase\Cest->runStep(object(Condition))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Scenario.php line 101
at Codeception\Scenario->runStep(object(Condition))
in /Volumes/Utilisateurs/marc/Sites/acme.com/tests/_support/_generated/AcceptanceTesterActions.php line 579
at Tests\AcceptanceTester->amOnRoute('acme_site_home.es')
in /Volumes/Utilisateurs/marc/Sites/acme.com/tests/acceptance/ExtranetBundle/Controller/DefaultControllerCest.php line 14
at Tests\Acceptance\ExtranetBundle\Controller\DefaultControllerCest->myTest(object(AcceptanceTester))
in line
at ReflectionMethod->invokeArgs(object(DefaultControllerCest), array(object(AcceptanceTester)))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Lib/Di.php line 112
at Codeception\Lib\Di->injectDependencies(object(DefaultControllerCest), 'myTest', array(object(AcceptanceTester), object(Scenario)))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/TestCase/Cest.php line 127
at Codeception\TestCase\Cest->invoke('myTest', array(object(AcceptanceTester), object(Scenario)))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/TestCase/Cest.php line 136
at Codeception\TestCase\Cest->executeTestMethod(object(AcceptanceTester))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/TestCase/Cest.php line 66
at Codeception\TestCase\Cest->testCodecept()
in line
at ReflectionMethod->invokeArgs(object(Cest), array())
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/TestCase.php line 909
at PHPUnit_Framework_TestCase->runTest()
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/TestCase.php line 768
at PHPUnit_Framework_TestCase->runBare()
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/TestResult.php line 612
at PHPUnit_Framework_TestResult->run(object(Cest))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/TestCase.php line 724
at PHPUnit_Framework_TestCase->run(object(PHPUnit_Framework_TestResult))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/phpunit/phpunit/src/Framework/TestSuite.php line 747
at PHPUnit_Framework_TestSuite->run(object(PHPUnit_Framework_TestResult))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/PHPUnit/Runner.php line 89
at Codeception\PHPUnit\Runner->doEnhancedRun(object(Suite), object(PHPUnit_Framework_TestResult), array(
'silent' => false,
'debug' => false,
'steps' => false,
'html' => false,
'xml' => false,
'json' => false,
'tap' => false,
'report' => false,
'colors' => true,
'coverage' => false,
'coverage-xml' => false,
'coverage-html' => false,
'coverage-text' => false,
'groups' => null,
'excludeGroups' => null,
'filter' => null,
'env' => null,
'fail-fast' => false,
'verbosity' => '4',
'interactive' => true,
'no-rebuild' => false,
'bootstrap' => '_bootstrap.php',
'memory_limit' => '1024M',
'log' => false,
'strict_xml' => false,
'verbose' => true
))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/SuiteManager.php line 153
at Codeception\SuiteManager->run(object(Runner), object(PHPUnit_Framework_TestResult), array(
'silent' => false,
'debug' => false,
'steps' => false,
'html' => false,
'xml' => false,
'json' => false,
'tap' => false,
'report' => false,
'colors' => true,
'coverage' => false,
'coverage-xml' => false,
'coverage-html' => false,
'coverage-text' => false,
'groups' => null,
'excludeGroups' => null,
'filter' => null,
'env' => null,
'fail-fast' => false,
'verbosity' => '4',
'interactive' => true,
'no-rebuild' => false,
'bootstrap' => '_bootstrap.php',
'memory_limit' => '1024M',
'log' => false,
'strict_xml' => false,
'verbose' => true
))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Codecept.php line 203
at Codeception\Codecept->runSuite(array(
'class_name' => 'AcceptanceTester',
'modules' => array(
'enabled' => array(
'Asserts',
'Db',
'Symfony2',
'Doctrine2',
'\Tests\Helper\Acceptance'
),
'config' => array(
'Db' => array(
'dsn' => 'mysql:host=localhost;dbname=acme_test',
'user' => 'root',
'password' => 'blahblah',
'dump' => 'tests/_data/dump.sql',
'populate' => false,
'cleanup' => false
),
'PhpBrowser' => array(
'url' => 'http://acme.com'
),
'WebDriver' => array(
'url' => 'http://acme.com',
'browser' => 'firefox'
),
'REST' => array(
'url' => 'http://acme.com',
'depends' => 'Symfony2'
),
'Doctrine2' => array(
'depends' => 'Symfony2',
'cleanup' => false
)
),
'depends' => array()
),
'colors' => true,
'bootstrap' => '_bootstrap.php',
'memory_limit' => '1024M',
'log' => false,
'strict_xml' => false,
'coverage' => array(),
'namespace' => 'Tests',
'groups' => array('failed' => 'tests/_output/failed'),
'path' => '/Volumes/Utilisateurs/marc/Sites/acme.com/tests/acceptance/',
'shuffle' => false,
'error_level' => 'E_ALL & ~E_STRICT & ~E_DEPRECATED'
),
'acceptance',
'ExtranetBundle/Controller/DefaultControllerCest.php'
)
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Codecept.php line 172
at Codeception\Codecept->run('acceptance', 'ExtranetBundle/Controller/DefaultControllerCest.php')
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/src/Codeception/Command/Run.php line 184
at Codeception\Command\Run->execute(object(ArgvInput), object(ConsoleOutput))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php line 259
at Symfony\Component\Console\Command\Command->run(object(ArgvInput), object(ConsoleOutput))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php line 878
at Symfony\Component\Console\Application->doRunCommand(object(Run), object(ArgvInput), object(ConsoleOutput))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php line 195
at Symfony\Component\Console\Application->doRun(object(ArgvInput), object(ConsoleOutput))
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php line 126
at Symfony\Component\Console\Application->run()
in /Volumes/Utilisateurs/marc/Sites/acme.com/vendor/codeception/codeception/codecept line 28
It was a two-sided issue:
The code doesn't handle unknown domains well and emits a warning, PhpUnit turns the warning into exception.
To test the request to specific domain, you must make request to that domain, e.g. $I->amOnPage('http://acme.com/es');. Since you are using a Symfony2 module, it doesn't make the actual HTTP request to that sites, but handles it internally. If you are using amOnRoute() method, make sure that the url generated by the route includes the hostname component.
P.S. I don't know how does the site bundle work, but I recommend having at least one hostname based route for that domain or your test may stop working with future versions of Codeception.
I have the problem that after the installation of FOSUserBundle I cannot access to Symfony anymore. Every command returns
[InvalidArgumentException] The file "/var/www/html/secerp/app/config/config_.yml" does not exist.
Seems he lost the this->environment Infomation of the app/AppKernel
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
Changes I did before:
[root#symfony secerp]# composer require friendsofsymfony/user-bundle "~2.0#dev"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
Clearing the cache for the dev environment with debug true
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets
Trying to install assets as symbolic links.
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
The assets were installed using symbolic links.
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution
The assets were installed using symbolic links.
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::removeSymfonyStandardFiles
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget
[root#symfony secerp]# cd vendor/
autoload.php doctrine/ incenteev/ kriswallsmith/ psr/ sensiolabs/ symfony/
composer/ friendsofsymfony/ jdorn/ monolog/ sensio/ swiftmailer/ twig/
[root#symfony secerp]# cd vendor/
autoload.php doctrine/ incenteev/ kriswallsmith/ psr/ sensiolabs/ symfony/
composer/ friendsofsymfony/ jdorn/ monolog/ sensio/ swiftmailer/ twig/
[root#symfony secerp]# php app/console cache:clear --env=prod
[InvalidArgumentException]
The file "/var/www/html/secerp/app/config/config_.yml" does not exist.
Can somebody help me to fix this problem or had the same problem before?
EDIT: Running the composer update again leads to the following results:
[root#symfony secerp]# composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
[Symfony\Component\DependencyInjection\Exception\RuntimeException]
A string value must be composed of strings and/or numbers, but found parameter "kernel.environment" of type NULL inside string value "%kernel.logs_dir%/%kernel.environment%.log".
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [packages1] ... [packagesN]
With the following error when I access a page:
RuntimeException in ParameterBag.php line 251:
A string value must be composed of strings and/or numbers, but found parameter "kernel.environment" of type NULL inside string value "%kernel.logs_dir%/%kernel.environment%.log".
in ParameterBag.php line 251
at ParameterBag->Symfony\Component\DependencyInjection\ParameterBag\{closure}(array('%kernel.environment%', 'kernel.environment'))
at preg_replace_callback('/%%|%([^%\s]+)%/', object(Closure), '%kernel.logs_dir%/%kernel.environment%.log') in ParameterBag.php line 258
at ParameterBag->resolveString('%kernel.logs_dir%/%kernel.environment%.log', array()) in ParameterBag.php line 203
at ParameterBag->resolveValue('%kernel.logs_dir%/%kernel.environment%.log', array()) in ParameterBag.php line 193
at ParameterBag->resolveValue(array('type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', 'level' => 'debug'), array()) in ParameterBag.php line 193
at ParameterBag->resolveValue(array('main' => array('type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', 'level' => 'debug'), 'console' => array('type' => 'console', 'bubble' => false, 'verbosity_levels' => array('VERBOSITY_VERBOSE' => 'INFO', 'VERBOSITY_VERY_VERBOSE' => 'DEBUG'), 'channels' => array('!doctrine')), 'console_very_verbose' => array('type' => 'console', 'bubble' => false, 'verbosity_levels' => array('VERBOSITY_VERBOSE' => 'NOTICE', 'VERBOSITY_VERY_VERBOSE' => 'NOTICE', 'VERBOSITY_DEBUG' => 'DEBUG'), 'channels' => array('doctrine'))), array()) in ParameterBag.php line 193
at ParameterBag->resolveValue(array('handlers' => array('main' => array('type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', 'level' => 'debug'), 'console' => array('type' => 'console', 'bubble' => false, 'verbosity_levels' => array('VERBOSITY_VERBOSE' => 'INFO', 'VERBOSITY_VERY_VERBOSE' => 'DEBUG'), 'channels' => array('!doctrine')), 'console_very_verbose' => array('type' => 'console', 'bubble' => false, 'verbosity_levels' => array('VERBOSITY_VERBOSE' => 'NOTICE', 'VERBOSITY_VERY_VERBOSE' => 'NOTICE', 'VERBOSITY_DEBUG' => 'DEBUG'), 'channels' => array('doctrine')))), array()) in ParameterBag.php line 193
at ParameterBag->resolveValue(array(array('handlers' => array('main' => array('type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', 'level' => 'debug'), 'console' => array('type' => 'console', 'bubble' => false, 'verbosity_levels' => array('VERBOSITY_VERBOSE' => 'INFO', 'VERBOSITY_VERY_VERBOSE' => 'DEBUG'), 'channels' => array('!doctrine')), 'console_very_verbose' => array('type' => 'console', 'bubble' => false, 'verbosity_levels' => array('VERBOSITY_VERBOSE' => 'NOTICE', 'VERBOSITY_VERY_VERBOSE' => 'NOTICE', 'VERBOSITY_DEBUG' => 'DEBUG'), 'channels' => array('doctrine')))))) in MergeExtensionConfigurationPass.php line 45
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in MergeExtensionConfigurationPass.php line 39
at MergeExtensionConfigurationPass->process(object(ContainerBuilder)) in Compiler.php line 117
at Compiler->compile(object(ContainerBuilder)) in ContainerBuilder.php line 614
at ContainerBuilder->compile() in bootstrap.php.cache line 2638
at Kernel->initializeContainer() in bootstrap.php.cache line 2411
at Kernel->boot() in bootstrap.php.cache line 2442
at Kernel->handle(object(Request)) in app_dev.php line 28
I just have generated another symfony-project folder and moved the source-files in it. No idea what went wrong...
I've seen that this question has been made Unsupported driver in laravel 4 when using laravel-oci8 package but the answere wasn't really usefull since the thread specify on https://github.com/yajra/laravel-oci8/issues/2 was resolved by just installing Oracle instant client and I already have it istalled.
I am trying to integrate oracle DB with laravel 5 app using yajra/laravel-oci8 package, I have folow the installation process and I have verified the specified requirements but with no success. When ever I try to run php artisan route:list or php artisan migrate it tells me that [InvalidArgumentException] Unsupported driver [oracle].
My Config/database.php is the following
...
'default' => 'oracle',
...
'connections' => [
'oracle' => array(
'driver' => 'oracle',
'host' => env('DB_HOST', 'localhost'),
'port' => '1521',
'database' => 'xe',
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'AL32UTF8',
'prefix' => '',
),
...
]
Am I missing any other configuration?
UPDATE
For anybody crossing this question.
The problem back then was that I incorrectly added the service provider (Yajra\Oci8\Oci8ServiceProvider::class,) class in the config/app.php
this is my config:
'oracle' => [
'driver' => 'oracle',
'tns' => "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = XE) (SID = XE)))",
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1521'),
'database' => env('DB_DATABASE', 'XE'),
'username' => env('DB_USERNAME', 'XEUSER'),
'password' => env('DB_PASSWORD', 'XEPASSWD'),
'charset' => env('DB_CHARSET', 'AL32UTF8'),
'prefix' => env('DB_PREFIX', ''),
'prefix_schema' => env('DB_SCHEMA_PREFIX', ''),
],
change your config :
'oracle' => [
'driver' => 'oci8',
'host' => 'localhost',
'port' => '1521',
'database' => 'oracle_ID',
'username' => 'username',
'password' => 'password',
'charset' => 'utf8',
'prefix' => '',
'prefix_schema' => '',
],
to check : take on your controller function
$data = DB::connection('oracle')->table('your_table')->take(1)->get();
var_dump($data);
it works for me