Twig syntax error when enabling ESI in symfony 2.1.8 - php

Ive attempted to add an ESI render with {'standalone': true} to one of my twig templates and am getting the TWIG syntax error of:
Unexpected token "punctuation" of value "," ("end of statement block" expected) in AccommMiddleBundle:Home:layout.html.twig at line 155
here is the relevant twig template block:
150 <div class="container">
151 <h1>{{ blog_articles.0.title }}</h1>
152 Moose
153 </div>
154
155 {% render url('accomm_middle_home_recent_articles', {fred: 1}), {'standalone': true} %}
156
157 {% set charity_url = "http://www.accommodation.com/charity" %}
Removing the , {'standalone': true} gets the template to render fine.
Im using Symfony 2.1.8 with a clean vendors and there seems to be no differences with the standard edition dependencies. Any ideas on how to debug this ?
thanks for any help
MikeB
p.s. here are my installed packages
AccomDotCom/AccomDotComRESTClientBundle 0.1 The RESTFul models for talking to the Accommodation.com privateapi (baghdadsquirrel) via symfony
behat/behat v2.4.5 Scenario-oriented BDD framework for PHP 5.3
behat/gherkin v2.2.9 Gherkin DSL parser for PHP 5.3
behat/mink v1.4.3 Web acceptance testing framework for PHP 5.3
behat/mink-browserkit-driver v1.0.4 Symfony2 BrowserKit driver for Mink framework
behat/mink-extension v1.0.1 Mink extension for Behat
behat/mink-selenium2-driver v1.0.5 Selenium2 (WebDriver) driver for Mink framework
behat/mink-zombie-driver v1.0.3 Zombie.js driver for Mink framework
behat/symfony2-extension v1.0.1 Symfony2 framework extension for Behat
doctrine/common 2.3.0 Common Library for Doctrine projects
doctrine/dbal 2.3.2 Database Abstraction Layer
doctrine/doctrine-bundle v1.0.0 Symfony DoctrineBundle
doctrine/orm 2.3.2 Object-Relational-Mapper for PHP
guzzle/guzzle v2.8.7 Guzzle is a PHP HTTP client library and framework for building RESTful web service clients
instaclick/php-webdriver 1.0.12 PHP WebDriver for Selenium 2
jms/aop-bundle 1.0.0 Adds AOP capabilities to Symfony2
jms/cg 1.0.0 Toolset for generating PHP code
jms/di-extra-bundle 1.1.1 Allows to configure dependency injection using annotations
jms/metadata 1.1.1 Class/method/property metadata management in PHP
jms/security-extra-bundle 1.2.0 Enhances the Symfony2 Security Component by adding several new features
kriswallsmith/assetic v1.1.0-alpha4 Asset Management for PHP
monolog/monolog 1.2.1 Logging for PHP 5.3
nelmio/esi-debug-bundle 1.0.0 Shows you caching information around ESI requests for debugging purposes
sensio/distribution-bundle v2.1.8 The base bundle for the Symfony Distributions
sensio/framework-extra-bundle v2.1.8 This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle v2.1.8 This bundle generates code for you
swiftmailer/swiftmailer v4.2.2 Swiftmailer, free feature-rich PHP mailer
symfony/assetic-bundle v2.1.2 Integrates Assetic into Symfony2
symfony/monolog-bundle v2.1.8 Symfony MonologBundle
symfony/swiftmailer-bundle v2.1.8 Symfony SwiftmailerBundle
symfony/symfony v2.1.8 The Symfony PHP framework
twig/extensions dev-master v1.0.0 Common additional features for Twig that do not directly belong in core
twig/twig v1.12.2 Twig, the flexible, fast, and secure template language for PHP
vipsoft/jira-extension v1.0.9 Load features for Behat from Jira issues

In Symfony2.1, to adapt your render block to the correct notation, you need to
put your arguments between single quote ' : in this case you would have'fred': 1
Add the with{} statement even if it's empty:
Which gives you:
{% render url('accomm_middle_home_recent_articles', {'fred': 1}) with {}, {'standalone': true} %}
Note: It looks like the with{} statement is absolutely needed in Symfony2.1, from this security release. However, Symfony might have changed this recently and I don't think it is needed in Symfony2.2 anymore.
{# the with argument is needed but ignored #}
And an example they provide with it:
{% render url("path_to_controller_router", { 'param': 1 }) with {}, { 'standalone': true } %}

Related

Doctrine getRepository call cannot find class following composer update

I have run a composer update on my Symfony 4.4 project and ran into an issue that will run throughout my project.
The following line:
$this->stadiumEntity = $this->getDoctrine()->getRepository('AppBundle:Stadium')
errors with:
Class AppBundle:Stadium does not exist
When I change it to the following it works, however there is clear some BC break in either Symfony itself or more likely one of the Doctrine packages. I just can't determine which one.
$this->stadiumEntity = $this->getDoctrine()->getRepository(Stadium::class)
I thought the issue was in doctrine/persistence, however the getRepository method hasn't really changed in 3 years.
composer show | grep doctrine
doctrine/annotations 1.13.2 Docblock Annotations Parser
doctrine/cache 2.2.0 PHP Doctrine Cache library is a popular cache implementation that supports many different drivers...
doctrine/collections 1.6.8 PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common 3.3.0 PHP Doctrine Common project is a library that provides additional functionality that other Doctri...
doctrine/data-fixtures 1.5.3 Data Fixtures for all Doctrine Object Managers
doctrine/dbal 2.13.9 Powerful PHP database abstraction layer (DBAL) with many features for database schema introspecti...
doctrine/deprecations v0.5.3 A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable...
doctrine/doctrine-bundle 2.6.3 Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle 3.4.2 Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle 3.0.3 Symfony DoctrineMigrationsBundle
doctrine/event-manager 1.1.1 The Doctrine Event Manager is a simple PHP event system that was built to be used with the variou...
doctrine/inflector 2.0.4 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to up...
doctrine/instantiator 1.4.1 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer 1.2.3 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations 3.4.2 PHP Doctrine Migrations project offer additional functionality on top of the database abstraction...
doctrine/orm 2.12.2 Object-Relational-Mapper for PHP
doctrine/persistence 3.0.2 The Doctrine Persistence project is a set of shared interfaces and functionality that the differe...
doctrine/sql-formatter 1.1.2 a PHP SQL highlighting library

Newly created PHP Codeception project is hanging on run with no error output

I followed both the Codeception and general PHP instructions in our wiki when I set up my project in PhpStorm. It worked perfectly with both the ./vendor/bin/codecept run and docker-compose run --rm codecept run ui_automation --env staging --debug for over a day. Now, when I run the same project, it attempts the first test and just hangs at this part:
julie#Julies-MacBook-Pro qa-tests % ./vendor/bin/codecept run
Codeception PHP Testing Framework v4.1.9
Powered by PHPUnit 9.4.2 by Sebastian Bergmann and contributors.
Running with seed:
Ui_automation Tests (2) --------------------------------------------------------------------
------------------------------------------------------------------------
- LoginCest: Test login
My environment is as such:
php 7.4.12
Mac OS Catalina 10.15.6
Composer 2.0.5
Codecept 4.1.11
Docker 19.03.13
And when I try to run it with the docker command I get this error. I was originally getting this error with the above command too but now I'm just getting it for the docker command:
julie#Julies-MacBook-Pro qa-tests % docker-compose run --rm codecept run  ui_automation --
env staging --debug
Starting qa-end-to-end-tests_db_1 ... done
Creating qa-end-to-end-tests_codecept_run ... done
==== Redirecting to Composer-installed version in vendor/codeception. You can skip this
using --no-redirect ====
Command "run " is not defined.
I wasn't doing anything other than adding locators when this problem suddenly appeared. Also I used to verify the flow through a VNCView window and I can see there that my project is pulling up Chrome but not going to any page.
https://github.com/Codeception/Codeception/issues/5495 says about the redirect line in the error, "This redirect is here for a reason - it prevents odd errors when different versions of Codeception or dependencies are installed in vendor dir and external locations and some classes are loaded from one place and some - from another." But, it doesn't give tips on how to resolve this.
I initially was following two sets of instructions, I may have set up composer twice (once with wget and once with homebrew) and tried fixing from that angle. I also was setting up my mac in it's entirety the same day so it's possible I downloaded something else that is somehow conflicting.
I have tried the following:
Using both PhpStorm and VSCode, both IDEs display the same behavior
Running ./vendor/bin/codecept clean and .vendor/bin/codecept build
Updating with "composer update" command
restarting IDEs, computer
Deleted composer according to these instructions: Remove composer
Re-installed composer with homebrew only
Uninstalled and reinstalled docker according to these instructions: https://nektony.com/how-to/uninstall-docker-on-mac
Added codeception/verify and codeception/specify to my composer.json
Made sure the URL the page is supposed to go to is still in my yaml file under Webdriver, URL
Noticed a "No CLI interpreter" in my Edit Configuration page in IntelliJ so re-added that and set PHP 7.4 to Interpreter). This was using the executable /usr/local/Cellar/php/7.4.12/bin/php
Looked in preferences and module settings, didn't see anything weird
Ran in verbose mode (-vvv) didn't get hints from that
Blew out my whole git repo and re-imported it
Ran composer show, saw many codeception packages
Ran autoload dump
Ran Tools > Composer > Diagnose in both regular and verbose and got back "Composer diagnosed some issues in ./composer.json." but it doesn't tell me what those issues are and there is nothing lit up or red in composer.json
Deleted the whole vendor folder and reinstalled composer
I now notice after the last step composer.phar is red! I have tried repeating the steps above but it is still red.
Right now I'd just like to get my project working through the regular ./vendor/bin/codecept run bc I have SREs to help with the Docker stuff, although I'd be happy to skip straight to docker working as that's how they'd like us to run it.
My composer.json (without the specify, verify troubleshooting step):
{
"require-dev": {
"codeception/robo-paracept": "^0.4.2",
"codeception/codeception": "^4.1",
"codeception/module-phpbrowser": "^1.0.0",
"codeception/module-asserts": "^1.0.0",
"codeception/module-webdriver": "^1.1",
"codeception/verify": "2.1.0",
"codeception/specify": "1.4.0",
"phpunit/phpunit": "^9.4"
},
"require": {
"ext-zip": "^1.15",
"codeception/specify": "*",
"codeception/verify": "*"
},
"autoload": {
"psr-4": {
"Tests\\Support\\": "tests/_support",
"UiAutomationTester\\": "tests/_support/UiAutomation.php"
}
}
}
I updated composer to 4.1.11 and verified that ./vendor/bin/codecept run -V matched the version in composer.json
composer -V says it's at Composer version 2.0.5
Results of composer-show:
codeception/lib-asserts 1.13.2 Assertion methods used by
Codeception core and Asserts module
codeception/lib-innerbrowser 1.3.4 Parent library for all Codeception framework modules and PhpBrowser
codeception/module-asserts 1.3.1 Codeception module containing various assertions
codeception/module-phpbrowser 1.0.2 Codeception module for testing web application over HTTP
codeception/module-webdriver 1.1.3 WebDriver module for Codeception
codeception/phpunit-wrapper 9.0.5 PHPUnit classes used by Codeception
codeception/robo-paracept 0.4.2 Codeception Parallel Execution Tasks via Robo Task Runner
codeception/stub 3.7.0 Flexible Stub wrapper for PHPUnit's Mock Builder
consolidation/annotated-command 4.2.3 Initialize Symfony Console commands from annotated command class methods.
consolidation/config 1.2.1 Provide configuration services for a commandline tool.
consolidation/log 2.0.1 Improved Psr-3 / Psr\Log logger based on Symfony Console components.
consolidation/output-formatters 4.1.1 Format text by applying transformations provided by plug-in formatters.
consolidation/robo 1.4.13 Modern task runner
consolidation/self-update 1.2.0 Provides a self:update command for Symfony Console applications.
container-interop/container-interop 1.2.0 Promoting the interoperability of container objects (DIC, SL, etc.)
dflydev/dot-access-data v1.1.0 Given a deep data structure, access data by dot notation.
doctrine/instantiator 1.3.1 A small, lightweight utility to instantiate objects in PHP without invoking their constr...
grasmash/expander 1.0.0 Expands internal property references in PHP arrays file.
grasmash/yaml-expander 1.4.0 Expands internal property references in a yaml file.
guzzlehttp/guzzle 7.2.0 Guzzle is a PHP HTTP client library
guzzlehttp/promises 1.4.0 Guzzle promises library
guzzlehttp/psr7 1.7.0 PSR-7 message implementation that also provides common utility methods
league/container 2.4.1 A fast and intuitive dependency injection container.
monolog/monolog 2.1.1 Sends your logs to files, sockets, inboxes, databases and various web services
myclabs/deep-copy 1.10.1 Create deep copies (clones) of your objects
nikic/php-parser v4.10.2 A PHP parser written in PHP
phar-io/manifest 2.0.1 Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version 3.0.2 Library for handling version information and constraints
php-webdriver/webdriver 1.8.3 A PHP client for Selenium WebDriver. Previously facebook/webdriver.
phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock 5.2.2 With this component, a library can provide support for annotations via DocBlocks or othe...
phpdocumentor/type-resolver 1.4.0 A PSR-5 based resolver of Class names, Types and Structural Element Names
phpspec/prophecy 1.12.1 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 9.2.3 Library that provides collection, processing, and rendering functionality for PHP code c...
phpunit/php-file-iterator 3.0.5 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker 3.1.1 Invoke callables with a timeout
phpunit/php-text-template 2.0.4 Simple template engine.
phpunit/php-timer 5.0.3 Utility class for timing
phpunit/phpunit 9.4.2 The PHP Unit Testing framework.
psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11)
psr/http-client 1.0.1 Common interface for HTTP clients
psr/http-message 1.0.1 Common interface for HTTP messages
psr/log 1.1.3 Common interface for logging libraries
ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.
sebastian/cli-parser 1.0.1 Library for parsing CLI options
sebastian/code-unit 1.0.8 Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 2.0.3 Looks up which function or method a line of code belongs to
sebastian/comparator 4.0.6 Provides the functionality to compare PHP values for equality
sebastian/complexity 2.0.2 Library for calculating the complexity of PHP code units
sebastian/diff 4.0.4 Diff implementation
sebastian/environment 5.1.3 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 4.0.3 Provides the functionality to export PHP variables for visualization
sebastian/global-state 5.0.2 Snapshotting of global state
sebastian/lines-of-code 1.0.2 Library for counting the lines of code in PHP source code
sebastian/object-enumerator 4.0.4 Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector 2.0.4 Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context 4.0.4 Provides functionality to recursively process PHP variables
sebastian/resource-operations 3.0.3 Provides a list of PHP built-in functions that operate on resources
sebastian/type 2.3.1 Collection of value objects that represent the types of the PHP type system
sebastian/version 3.0.2 Library that helps with managing the version number of Git-hosted PHP projects
symfony/browser-kit v5.1.8 Symfony BrowserKit Component
symfony/console v4.4.16 Symfony Console Component
symfony/css-selector v5.1.8 Symfony CssSelector Component
symfony/dom-crawler v5.1.8 Symfony DomCrawler Component
symfony/event-dispatcher v4.4.16 Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v1.1.9 Generic abstractions related to dispatching event
symfony/filesystem v4.4.16 Symfony Filesystem Component
symfony/finder v5.1.8 Symfony Finder Component
symfony/polyfill-ctype v1.20.0 Symfony polyfill for ctype functions
symfony/polyfill-mbstring v1.20.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php73 v1.20.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80 v1.20.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/process v4.4.16 Symfony Process Component
symfony/service-contracts v2.2.0 Generic abstractions related to writing services
symfony/yaml v4.4.16 Symfony Yaml Component
theseer/tokenizer 1.2.0 A small library for converting tokenized PHP source code into XML and potentially other ...
webmozart/assert 1.9.1 Assertions to validate method input/output with nice error messages.
I don't know much about PHP set up or Codeception, this is my first project in either. This is running on everyone else's machine in QA except mine!

Sonata Media Bundle - INVALID MODE

I am using Sonata Admin Bundle and Sonata Media Bundle. I use those versions. Symfony Version is 4.4.3
sonata-project/admin-bundle 3.58.0 The missing Symfony Admin Generator
sonata-project/block-bundle 3.18.3 Symfony SonataBlockBundle
sonata-project/cache 2.0.1 Cache library
sonata-project/core-bundle 3.17.2 Symfony SonataCoreBundle (abandoned)
sonata-project/datagrid-bundle 2.5.0 Symfony SonataDatagridBundle
sonata-project/doctrine-extensions 1.5.1 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.13.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle 2.5.0 Symfony SonataEasyExtendsBundle
sonata-project/exporter 2.0.1 Lightweight Exporter library
sonata-project/media-bundle 3.23.0 Symfony SonataMediaBundle
Furthermore I use the GalleryAdmin provided by the Media Bundle without any changes. In the Gallery Edit case I get following error:
INVALID MODE : s5e37f8b81382b_galleryHasMedias - type : CollectionType - mapping :
This error message is printed where the upload / edit forms of the Gallery Media Items should be:
There are few other people having the same error but i haven't found a working solution to it. Does someone know how to get rid of this error?
I've found this for you.
Maybe this could help, it looks like the error is comming from the ORM. You have to run app/console doctrine:cache:clear-metadata and then re-running doctrine:schema:update --force
source : INVALID MODE : s5a869f19a6c57_equivalents - type : sonata_type_collection - mapping :

Symfony 2.8 to 3.0 migration

I want to upgrade symfony 2.8 project to 3.0, i changed the version in composer.json to 3.0.* but after composer update is done, i have these error in console:
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command:
PHP Fatal error: Class 'Symfony\Component\HttpKernel\Kernel' not found in
/var/www/html/t/EcoPro/app/AppKernel.php on line 6
It sounds like your code can't find the Kernel class from Symfony. Since it should still be there, as you can see in the Symfony repository in the 3.0-branch I assume something went wrong during your update.
I suggest first running composer diagnose to see if composer itself is up to date and your composer.json is syntactically valid. As a next step you should verify the current version of your dependencies by running composer show. The output should look something like this:
$ composer show
doctrine/annotations v1.2.7 Docblock Annotations Parser
doctrine/cache v1.5.1 Caching library offering an object-oriented API for many cache backends
doctrine/collections v1.3.0 Collections Abstraction library
doctrine/common v2.5.1 Common Library for Doctrine projects
doctrine/dbal v2.5.2 Database Abstraction Layer
doctrine/doctrine-bundle 1.6.0 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.2.2 Symfony Bundle for Doctrine Cache
doctrine/inflector v1.1.0 Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm v2.5.2 Object-Relational-Mapper for PHP
incenteev/composer-parameter-handler v2.1.2 Composer script handling your ignored parameter file
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting library
monolog/monolog 1.17.2 Sends your logs to files, sockets, inboxes, databases and various web services
paragonie/random_compat 1.1.0 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
psr/log 1.0.0 Common interface for logging libraries
sensio/distribution-bundle v5.0.2 Base bundle for Symfony Distributions
sensio/framework-extra-bundle v3.0.11 This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle v3.0.0 This bundle generates code for you
sensiolabs/security-checker v3.0.2 A security checker for your composer.lock
swiftmailer/swiftmailer v5.4.1 Swiftmailer, free feature-rich PHP mailer
symfony/monolog-bundle v2.8.2 Symfony MonologBundle
symfony/phpunit-bridge v2.8.0 Symfony PHPUnit Bridge
symfony/polyfill-intl-icu v1.0.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.0.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56 v1.0.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.0.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.0.0 Symfony utilities for portability of PHP codes
symfony/swiftmailer-bundle v2.3.9 Symfony SwiftmailerBundle
symfony/symfony v3.0.0 The Symfony PHP framework
twig/twig v1.23.1 Twig, the flexible, fast, and secure template language for PHP
This should help you see whether the update actually worked. If all looks fine, I would go the safe route and revert your code back to 2.8 and then do the update like explained below, instead of changing the composer.json!
First make sure you fixed all deprecations in your existing application. You can use the UPGRADE-document as reference, but also run your tests and check the logs for deprecated calls. This will become easier with 3.3+ as these versions have a separate deprecation-log that you can find in var/log alongside the other log files.
Once you are reasonably sure you code will run with a new major version, just use the following composer command:
composer require symfony/lts:"^3.0"
This is only to make sure that we don't accidentally install any Symfony component that is 4.0 during the process. Once you want to upgrade to Symfony 4 you can just remove this dependency using composer remove symfony/lts and then run update.
After the lts meta package is in place you can update Symfony itself:
composer require symfony/symfony:^3.0
to update to the newest 3.x that your dependencies support or use a stricter constraint if you really want to go step by step:
composer require symfony/symfony:3.0.*
You can also do both things in one step if you like:
$ composer require symfony/lts:^3.0 symfony/symfony:^3.0
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 5 installs, 2 updates, 0 removals
- Updating symfony/symfony (v2.8.32 => v3.4.2): Downloading (100%)
- Installing psr/simple-cache (1.0.0): Loading from cache
- Installing psr/link (1.0.0): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing psr/cache (1.0.1): Loading from cache
- Installing fig/link-util (1.0.0): Loading from cache
Writing lock file
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
[OK] Cache for the "dev" environment (debug=true) was successfully cleared.
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets
Trying to install assets as relative symbolic links.
[OK] No assets were provided by any bundle.
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget
This should already be enough to have Symfony on the newer version. You will likely have other dependencies such as Doctrine or some bundles that you have installed as well. There are a few useful commands for updating them.
First you can update only a single dependency at a time:
composer update doctrine/orm
When you add the option --with-dependencies it will also update doctrine/orm's dependencies.
You can always ask composer why or composer why-not with a dependency and optionally a version to check why a dependency is there and why it won't update. Just type composer help why-not to see how to use it. This is particularly helpful when you want to update a dependency like doctrine/orm, but composer throws an error that it can't do it.

Laravel 5 PHPUnit test fails with getContent() on null

I'm getting an error when I want to run a PHPUnit test on my Laravel 5 website. Can you give me a hint? Already updated both composer and phpunit package.
PHPUnit 5.2.12 by Sebastian Bergmann and contributors.
Starting test 'Warning'.
W
Starting test 'ExampleTest::testEncryptionIsIntelligent'.
PHP Fatal error: Call to a member function getContent() on null in /var/www/hu.testsite/vendor/laravel/framework/src/Illuminate/Foundation/Testing/InteractsWithPages.php on line 187
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to a member function getContent() on null
Here is my test file:
<?
class ExampleTest extends TestCase
{
/**
* My test implementation
*/
public function testEncryptionIsIntelligent()
{
$this->see('Laravel 5');
$this->visit('/');
$this->visit('/auth/login');
$this->type('test.admin#testsite.hu', 'email');
$this->type('test', 'password');
$this->press('');
$this->seePageIs('/admin');
$this->see('Welcome to the dashboard');
$this->visit('/');
}
}
And here are the composer packages installed:
barryvdh/elfinder-flysystem-driver v0.1.4 A Flysystem Driver for elFinder
barryvdh/laravel-debugbar v2.2.0 PHP Debugbar integration for Laravel
barryvdh/laravel-elfinder v0.3.6 A Laravel Package to integrate elFinder 2
behat/behat v3.0.15 Scenario-oriented BDD framework for PHP 5.3
behat/gherkin v4.4.1 Gherkin DSL parser for PHP 5.3
behat/mink v1.7.1 Browser controller/emulator abstraction for PHP
behat/mink-browserkit-driver v1.3.2 Symfony2 BrowserKit driver for Mink framework
behat/mink-extension v2.2 Mink extension for Behat
behat/mink-goutte-driver v1.2.1 Goutte driver for Mink framework
behat/mink-selenium2-driver v1.3.1 Selenium2 (WebDriver) driver for Mink framework
behat/transliterator v1.1.0 String transliterator
classpreloader/classpreloader 3.0.0 Helps class loading performance by generating a single PHP file containing all of the autoloaded files for a specific use case
danielstjules/stringy 1.10.0 A string manipulation library with multibyte support
davejamesmiller/laravel-breadcrumbs 3.0.0 A simple Laravel-style way to create breadcrumbs in Laravel 4+.
dnoegel/php-xdg-base-dir 0.1 implementation of xdg base directory specification for php
doctrine/inflector v1.1.0 Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
fabpot/goutte v3.1.2 A simple PHP Web Scraper
fzaninotto/faker v1.5.0 Faker is a PHP library that generates fake data for you.
greggilbert/recaptcha 2.1.1 reCAPTCHA Validator for Laravel 5
guzzlehttp/guzzle 6.2.0 Guzzle is a PHP HTTP client library
guzzlehttp/promises 1.1.0 Guzzle promises library
guzzlehttp/psr7 1.2.3 PSR-7 message implementation
hamcrest/hamcrest-php v1.2.2 This is the PHP port of Hamcrest Matchers
illuminate/html v5.0.0
instaclick/php-webdriver 1.4.3 PHP WebDriver for Selenium 2
intervention/image 2.3.6 Image handling and manipulation library with support for Laravel integration
jakub-onderka/php-console-color 0.1
jakub-onderka/php-console-highlighter v0.3.2
jeremeamia/SuperClosure 2.2.0 Serialize Closure objects, including their context and binding
laracasts/behat-laravel-extension 1.0 Laravel extension for Behat
laravel/framework v5.1.31 The Laravel Framework.
league/flysystem 1.0.20 Filesystem abstraction: Many filesystems, one API.
maatwebsite/excel v2.1.2 An eloquent way of importing and exporting Excel and CSV in Laravel 4 with the power of PHPExcel
maximebf/debugbar v1.11.1 Debug bar in the browser for php application
mockery/mockery 0.9.4 Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing...
monolog/monolog 1.18.1 Sends your logs to files, sockets, inboxes, databases and various web services
mtdowling/cron-expression v1.1.0 CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
myclabs/deep-copy 1.5.0 Create deep copies (clones) of your objects
nesbot/carbon 1.21.0 A simple API extension for DateTime.
nikic/php-parser v2.0.1 A PHP parser written in PHP
paragonie/random_compat v1.4.1 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phpdocumentor/reflection-docblock 2.0.4
phpoffice/phpexcel 1.8.1 PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
phpspec/php-diff v1.0.2 A comprehensive library for generating differences between two hashable objects (strings or arrays).
phpspec/phpspec 2.5.0 Specification-oriented BDD framework for PHP 5.3+
phpspec/prophecy v1.6.0 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 3.3.0 Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator 1.4.1 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 1.0.7 Utility class for timing
phpunit/php-token-stream 1.4.8 Wrapper around PHP's tokenizer extension.
phpunit/phpunit 5.2.12 The PHP Unit Testing framework.
phpunit/phpunit-mock-objects 3.1.0 Mock Object library for PHPUnit
psr/http-message 1.0 Common interface for HTTP messages
psr/log 1.0.0 Common interface for logging libraries
psy/psysh v0.7.2 An interactive shell for modern PHP.
sebastian/code-unit-reverse-lookup 1.0.0 Looks up which function or method a line of code belongs to
sebastian/comparator 1.2.0 Provides the functionality to compare PHP values for equality
sebastian/diff 1.4.1 Diff implementation
sebastian/environment 1.3.5 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 1.2.1 Provides the functionality to export PHP variables for visualization
sebastian/global-state 1.1.1 Snapshotting of global state
sebastian/recursion-context 1.0.2 Provides functionality to recursively process PHP variables
sebastian/resource-operations 1.0.0 Provides a list of PHP built-in functions that operate on resources
sebastian/version 1.0.6 Library that helps with managing the version number of Git-hosted PHP projects
studio-42/elfinder 2.1.9 File manager for web
swiftmailer/swiftmailer v5.4.1 Swiftmailer, free feature-rich PHP mailer
symfony/browser-kit v2.8.3 Symfony BrowserKit Component
symfony/class-loader v2.8.3 Symfony ClassLoader Component
symfony/config v2.8.3 Symfony Config Component
symfony/console v2.7.10 Symfony Console Component
symfony/css-selector v2.7.10 Symfony CssSelector Component
symfony/debug v2.7.10 Symfony Debug Component
symfony/dependency-injection v2.8.3 Symfony DependencyInjection Component
symfony/dom-crawler v2.7.10 Symfony DomCrawler Component
symfony/event-dispatcher v2.8.3 Symfony EventDispatcher Component
symfony/filesystem v3.0.3 Symfony Filesystem Component
symfony/finder v2.7.10 Symfony Finder Component
symfony/http-foundation v2.7.10 Symfony HttpFoundation Component
symfony/http-kernel v2.7.10 Symfony HttpKernel Component
symfony/polyfill-apcu v1.1.1 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-php56 v1.1.1 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-util v1.1.1 Symfony utilities for portability of PHP codes
symfony/process v2.7.10 Symfony Process Component
symfony/routing v2.7.10 Symfony Routing Component
symfony/translation v2.7.10 Symfony Translation Component
symfony/var-dumper v2.7.10 Symfony mechanism for exploring and dumping PHP variables
symfony/yaml v2.8.3 Symfony Yaml Component
tijsverkoyen/css-to-inline-styles 1.5.5 CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is v...
vlucas/phpdotenv v1.1.1 Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
watson/sitemap 2.0.12 Generate Google Sitemaps in Laravel 4/5
And help would be appreciate.
Change this:
$this->see('Laravel 5');
$this->visit('/');
to
$this->visit('/')
->see('Laravel 5');
You are trying to first check for something that laravel is unaware of where to check for. First visit a page and then check for the content.
I would chain the lines as follows:
$this->visit('/')
->see('Laravel 5')
->visit('/auth/login')
->type('test.admin#testsite.hu', 'email')
->type('test', 'password')
->press('')
->seePageIs('/admin')
->visit('/')
->see('Welcome to the dashboard');

Categories