Giter Club home page Giter Club logo

module-laminas's Introduction

Stand With Ukraine

Codeception

Latest Stable Total Downloads StandWithUkraine Build status

Modern PHP Testing for everyone

Codeception is a modern full-stack testing framework for PHP. Inspired by BDD, it provides an absolutely new way of writing acceptance, functional and even unit tests.

Contributions

At Codeception we are glad to receive contributions from the community. If you want to send additions or fixes to the code or the documentation please check the Contributing guide.

At a Glance

Describe what you test and how you test it. Use PHP to write descriptions faster.

Run tests and see what actions were taken and what results were seen.

Sample test

$I->amOnPage('/');
$I->click('Pages');
$I->click('New');
$I->see('New Page');
$I->submitForm('form#new_page', ['title' => 'Movie Review']);
$I->see('page created'); // notice generated
$I->see('Movie Review','h1'); // head of page of is our title
$I->seeInCurrentUrl('pages/movie-review'); // slug is generated
$I->seeInDatabase('pages', ['title' => 'Movie Review']); // data is stored in database

For unit testing you can stay on classic PHPUnit tests, as Codeception can run them too.

Installation

Composer

php composer.phar require "codeception/codeception"

TODO: Document how to install the modules, e.g.

php composer.phar require "codeception/module-phpbrowser"

Phar

Download codecept.phar

Copy it into your project.

You can also make Codeception an executable and it put it into your $PATH, for instance:

wget https://codeception.com/codecept.phar

chmod +x codecept.phar

sudo mv codecept.phar /usr/local/bin/codecept

You can then run Codecept in the command line using: codecept bootstrap, codecept run, etc

Run CLI utility:

php codecept.phar

See also Installation | QuickStart

Getting Started

After you successfully installed Codeception, run this command:

codecept bootstrap

This will create a default directory structure and default test suites.

Documentation

View Documentation

The documentation source files can be found at https://github.com/Codeception/codeception.github.com/tree/master/docs/.

License

MIT

module-laminas's People

Contributors

arhell avatar astepin avatar bartdens avatar bittarman avatar bladeofsteel avatar bnpatel1990 avatar carnage avatar danielss89 avatar davertmik avatar dranzd avatar exorus avatar fntm avatar gorp avatar janhenkgerritsen avatar javabudd avatar jstewmc avatar kalessil avatar mosalski avatar naktibalda avatar olexp avatar omnilight avatar svycka avatar tasselchof avatar tavoniievez avatar thomaslandauer avatar zbateson avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

module-laminas's Issues

Property $application is not set

When trying to access the public property $application, it is empty. Also, I could not find where the code sets the property. All I find is that it is only declared in the module class.

What I am trying is this (I use ZF2, but upon inspection it seems that the same applies to Laminas):

$this->getModule('ZF2')->application->getServiceManager()

But it does not work because of an error.


[Error] Call to a member function getServiceManager() on null

Is it a bug or there is a specific use case for this property? Could not find any hint in the documentation.

Laminas->createApplication() called too many times

I'm trying to override the ServiceManager in my functional tests. I understand this needs to be done in _beforeStep() (true?)

But in watching Codeception and the Laminas module work, I was surprised at how many times Laminas->createApplication() is called.

I would expect one fresh application per simulated HTTP request (e.g. ->see() or ->click()), but there are more than that:

Trimmed stack traces:

Laminas.php:182, Codeception\Lib\Connector\Laminas->createApplication()   <----- HERE
Laminas.php:106, Codeception\Module\Laminas->_initialize()
SuiteManager.php:83, Codeception\SuiteManager->initialize()  <----- BECAUSE OF THIS EVENT/STEP
Codecept.php:204, Codeception\Codecept->runSuite()

_beforeSuite() is called

Laminas.php:182, Codeception\Lib\Connector\Laminas->createApplication()   <----- HERE
Laminas.php:34, Codeception\Lib\Connector\Laminas->setApplicationConfig()
Laminas.php:112, Codeception\Module\Laminas->_before()
Module.php:56, Codeception\Subscriber\Module->before()  <----- BECAUSE OF THIS EVENT/STEP
EventDispatcher.php:230, Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
EventDispatcher.php:59, Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
DispatcherWrapper.php:22, Codeception\PHPUnit\Listener->dispatch()
Listener.php:134, Codeception\PHPUnit\Listener->fire()
Listener.php:103, Codeception\PHPUnit\Listener->startTest()
TestResult.php:434, PHPUnit\Framework\TestResult->startTest()
Test.php:80, Codeception\Test\Cest->run()
TestSuite.php:677, Codeception\Suite->run()
Runner.php:117, Codeception\PHPUnit\Runner->doEnhancedRun()
SuiteManager.php:161, Codeception\SuiteManager->run()
Codecept.php:208, Codeception\Codecept->runSuite()
Codecept.php:162, Codeception\Codecept->run()

MyCest->_before() is called

Laminas.php:182, Codeception\Lib\Connector\Laminas->createApplication()  <----- HERE
Laminas.php:46, Codeception\Lib\Connector\Laminas->doRequest()
AbstractBrowser.php:384, Codeception\Lib\Connector\Laminas->request()
InnerBrowser.php:233, Codeception\Module\Laminas->clientRequest()
InnerBrowser.php:281, Codeception\Module\Laminas->_loadPage()
InnerBrowser.php:393, Codeception\Module\Laminas->amOnPage()    <----- BECAUSE OF THIS EVENT/STEP

Laminas.php:182, Codeception\Lib\Connector\Laminas->createApplication()  <----- HERE
Laminas.php:46, Codeception\Lib\Connector\Laminas->doRequest()
AbstractBrowser.php:384, Codeception\Lib\Connector\Laminas->request()
InnerBrowser.php:233, Codeception\Module\Laminas->clientRequest()
InnerBrowser.php:936, Codeception\Module\Laminas->proceedSubmitForm()
InnerBrowser.php:492, Codeception\Module\Laminas->clickButton()
InnerBrowser.php:451, Codeception\Module\Laminas->clickByLocator()
InnerBrowser.php:424, Codeception\Module\Laminas->click()     <----- BECAUSE OF THIS EVENT/STEP

Is this expected? The two before _before() seem unnecessary/unused.

Remove dependency on laminas/laminas-console

laminas/laminas-console (https://github.com/laminas/laminas-console/) is deprecated and will not receive any more updates. Its PHP version is stuck in the 5's and 7's, thus preventing an upgrade to 8 for systems that use this library.

It is recommended to upgrade to laminas/laminas-cli (https://github.com/laminas/laminas-cli), however this is not necessary here as there is only one mention of the laminas-console repo, which sets overrideIsConsole to false (src/Codeception/Module/Laminas.php:99)

Drop Laminas DB dependency

There's a dependency on Laminas\Db, and public property in the Laminas module, but the adapter is never initialised. As the Laminas\Db project is effectively EOL (security-only), maybe it would be worth removing the dependency?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.