Comments (10)
@Laykou - can you paste the content of the codecept binary please? Or just confirm if it uses some Cake\
classes or not.
I don't have Windows and haven't tested it on that (yet) but have a feeling it is not over-writing the binary.
from codeception.
Yes, I looked at it and this is my
\vendor\bin\codecept
#!/usr/bin/env sh
SRC_DIR="`pwd`"
cd "`dirname "$0"`"
cd "../codeception/codeception"
BIN_TARGET="`pwd`/codecept"
cd "$SRC_DIR"
"$BIN_TARGET" "$@"
\vendor\bin\codecept.bat
@ECHO OFF
SET BIN_TARGET=%~dp0/../codeception/codeception/codecept
php "%BIN_TARGET%" %*
They look like original bin files from codeception. I saw that the file vendor\cakephp\codeception\src\Command\Bootstrap.php
should update the codecept
file, but even the content is wrong.....
Let me know if there is anything I can test for you on the windows. I tried it several times with the fresh composer update and always ended upt like thi.s
from codeception.
Ok. Thanks, this confirms what I had suspected. Looks like I have some work to do on Windows.
I am curious to know why your files are different from the ones in Codeception repo:
- https://github.com/Codeception/Codeception/blob/2.0/codecept
- https://github.com/Codeception/Codeception/blob/2.0/codecept.bat
The Cake\Codeception\Console\Installer::postAutoloadDump()
script will only edit codecept
and only if it is in a format like the one I linked to on the Codeception repo.
Here's how the codecept file looks like on *NIX platforms (after being edited by the installer):
#!/usr/bin/env php
<?php
/**
* Codeception CLI
*/
require_once dirname(__FILE__).'/autoload.php';
use Symfony\Component\Console\Application;
$app = new Application('Codeception', Codeception\Codecept::VERSION);
$app->add(new Cake\Codeception\Command\Build('build'));
$app->add(new Codeception\Command\Run('run'));
$app->add(new Codeception\Command\Console('console'));
$app->add(new Cake\Codeception\Command\Bootstrap('bootstrap'));
$app->add(new Codeception\Command\GenerateCept('generate:cept'));
$app->add(new Codeception\Command\GenerateCest('generate:cest'));
$app->add(new Codeception\Command\GenerateTest('generate:test'));
$app->add(new Codeception\Command\GeneratePhpUnit('generate:phpunit'));
$app->add(new Codeception\Command\GenerateSuite('generate:suite'));
$app->add(new Codeception\Command\GenerateHelper('generate:helper'));
$app->add(new Codeception\Command\GenerateScenarios('generate:scenarios'));
$app->add(new Codeception\Command\Clean('clean'));
$app->add(new Cake\Codeception\Command\GenerateGroup('generate:group'));
$app->add(new Codeception\Command\GeneratePageObject('generate:pageobject'));
$app->add(new Codeception\Command\GenerateStepObject('generate:stepobject'));
$app->run();
It won't work no matter how many times you will try since it just doesn't seem to autoload the same way on both platforms.
Maybe if we identify why it has a different codecept
file, we'll get to the solution?
from codeception.
What line of script (what file) is responsible for copying the file into vendor\bin folder? I'm not that skilled with composer and how it works, but I learn quickly and I will do my best to find the solution :)
from codeception.
@Laykou - in the case of Codeception, I believe this part of Composer's code:
from codeception.
@jadb You got it! So that's how composer works: for windows it doesn't copy the file but only creates the proxy link to the real file:
// From the composer/LibraryInstaller.php
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
} else {
symlink($relativeBin, $link)
}
// The proxy code function
protected function generateUnixyProxyCode($bin, $link)
{
$binPath = $this->filesystem->findShortestPath($link, $bin);
return "#!/usr/bin/env sh\n".
'SRC_DIR="`pwd`"'."\n".
'cd "`dirname "$0"`"'."\n".
'cd '.ProcessExecutor::escape(dirname($binPath))."\n".
'BIN_TARGET="`pwd`/'.basename($binPath)."\"\n".
'cd "$SRC_DIR"'."\n".
'"$BIN_TARGET" "$@"'."\n";
}
Thats because on unix systems the symlink is created which is not available in the Windows. But then is the concept of ovewriting the file good? Because even in the Linux the original file codeception\codeception\codecept
will be overwritten (because of the symlink). Am I wrong?
from codeception.
While it's not what I would have preferred, overwriting is the only solution for now.
Codeception, even though object-oriented, gives no other way but to either:
a- overwrite the codecept binary
b- create our own to instantiate the right classes for templates and folder structure
For now, I am content with this solution as when using codecept
in a CakePHP application environment, rarely (if ever), will one need the original Codeception behavior.
from codeception.
What if the Installer.php
would create the new content of the codecept
file instead of just overwritting the namespaces?
from codeception.
@Laykou if that's the only way to resolve it for Windows, then yes. The original reasons I prefer modifying it instead of re-writing it was that maybe codeception upgrades, adds a new command but we don't need to customize that command, why have to update our code? If that makes any sense. So again, if it's the only solution, then it can be considered, otherwise, sticking to the way it is now is better IMO.
Also, it's good to add, that this is a temporary solution. I do have plans for this library to have a TestShell
ala MigrationShell
(for phinx) but no time yet. I'll be happy to help anyone who wants to do it though.
from codeception.
What if the codecept
file was edited directly in the vendor/codeception/codeception
? Technically there is no change on the Linux machine while making the Windows to do the same work.
Closing as there is a pull request.
from codeception.
Related Issues (18)
- Update README - customizeCodeceptionBinary part of skeleton app Installer
- Shift sample_app to other branch because of multiple definition of namespaces HOT 1
- App does'nt use test DB in functional testing HOT 1
- Installation of vendor/bin/codecept goes wrong HOT 6
- Don't get fixtures in unit testing running HOT 8
- Can't set http headers HOT 1
- Error Constant already defined HOT 3
- Cakephp 2.x HOT 1
- Wrong codeception composer dependency
- Compatibility problem with symfony/browser-kit v2.8.7
- Can't install with composer HOT 3
- Is there a Cake 2.x option? HOT 1
- Updating to codeception 2.3 HOT 2
- Broken with cakephp 3.6 HOT 5
- Fatal Error undefined function loadPHPUnitAliases() HOT 1
- Codeception Tests take 'default' datasource instead of 'test'
- Documentation - how to prepare database HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codeception.