Skip to content

Commit

Permalink
Merge pull request #289 from lucatume/release/2.2.19
Browse files Browse the repository at this point in the history
release 2.2.19
  • Loading branch information
lucatume authored Aug 16, 2019
2 parents 3bd8c47 + ee1c6a9 commit abfeaf3
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ WordPress structure and management: [e.g. default, Bedrock, other]
If applicable, try to walk through the test and execute it manually: can you do it using the browser?

**Codeception configuration file**
Paste, in a fenced YAML block, the content of your Codeception configuration file; remove any sensible data!
Paste, in a fenced YAML block, the content of your Codeception configuration file; remove any sensitive data!

```yaml
actor: Tester
Expand All @@ -39,7 +39,7 @@ params:
**Suite configuration file**
Paste, in a fenced YAML block, the content of the suite configuration file; remove any sensible data!
Paste, in a fenced YAML block, the content of the suite configuration file; remove any sensitive data!
```yaml
# Codeception Test Suite Configuration
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/setup-issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The bootstrap command is the recommended way to scaffold tests.
Codeception documentation can be found [here](https://codeception.com/docs/01-Introduction), wp-browser documentation can be found [here](https://wpbrowser.wptestkit.dev/).

**Codeception configuration file**
If you were able to complete the setup then paste, in a fenced YAML block, the content of your Codeception configuration file; remove any sensible data!
If you were able to complete the setup then paste, in a fenced YAML block, the content of your Codeception configuration file; remove any sensitive data!

```yaml
actor: Tester
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ All notable changes after version 1.6.16 to this project will be documented in t
This project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased] Unreleased

## [2.2.189] 2019-08-16;
### Fixed
- enhancements to the build scripts (thanks @karser)
- avoid redefining constants during `WPLoader` module bootstrap

## [2.2.18] 2019-08-02;
### Fixed
Expand Down Expand Up @@ -1087,4 +1090,5 @@ This project adheres to [Semantic Versioning](http://semver.org/).
[2.2.16]: https://github.com/lucatume/wp-browser/compare/2.2.15...2.2.16
[2.2.17]: https://github.com/lucatume/wp-browser/compare/2.2.16...2.2.17
[2.2.18]: https://github.com/lucatume/wp-browser/compare/2.2.17...2.2.18
[unreleased]: https://github.com/lucatume/wp-browser/compare/2.2.18...HEAD
[2.2.19]: https://github.com/lucatume/wp-browser/compare/2.2.18...2.2.19
[unreleased]: https://github.com/lucatume/wp-browser/compare/2.2.19...HEAD
11 changes: 8 additions & 3 deletions src/includes/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@
global $wpdb, $current_site, $current_blog, $wp_rewrite, $shortcode_tags, $wp, $phpmailer;

define('DIR_TESTDATA', __DIR__ . '/../data');
define('WP_LANG_DIR', DIR_TESTDATA . '/languages');

if(!defined('WP_LANG_DIR')){
define('WP_LANG_DIR', DIR_TESTDATA . '/languages');
}

if (!defined('WP_TESTS_FORCE_KNOWN_BUGS')) {
define('WP_TESTS_FORCE_KNOWN_BUGS', false);
}

// Cron tries to make an HTTP request to the blog, which always fails, because tests are run in CLI mode only
define('DISABLE_WP_CRON', true);
// Cron tries to make an HTTP request to the blog, which always fails, because tests are run in CLI mode only.
if(!defined('DISABLE_WP_CRON')){
define('DISABLE_WP_CRON', true);
}

define('REST_TESTS_IMPOSSIBLY_HIGH_NUMBER', 99999999);

Expand Down
15 changes: 8 additions & 7 deletions src/tad/WPBrowser/Module/WPLoader/FactoryStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,14 @@ public function __get($name)
$this->comment = new \WP_UnitTest_Factory_For_Comment();
break;
case 'blog':
if ( ! function_exists( 'is_multisite' ) || ! is_multisite() ) {
throw new ModuleException(
WPLoader::class, 'The `blog` factory can only be used in multisite context:' .
'in `WPLoader` module configuration set `multisite: true`; read more at ' .
'https://wpbrowser.wptestkit.dev/summary/modules/wploader#configuration'
);
}
if (! function_exists('is_multisite') || ! is_multisite()) {
throw new ModuleException(
WPLoader::class,
'The `blog` factory can only be used in multisite context:' .
'in `WPLoader` module configuration set `multisite: true`; read more at ' .
'https://wpbrowser.wptestkit.dev/summary/modules/wploader#configuration'
);
}
$this->blog = new \WP_UnitTest_Factory_For_Blog();
break;
case 'network':
Expand Down
20 changes: 11 additions & 9 deletions tests/wploader_multisite/FactoryTest.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

class FactoryTest extends \Codeception\TestCase\WPTestCase {
/**
* It should expose the blog factory on the tester property
*
* @test
*/
public function should_expose_the_blog_factory_on_the_tester_property() {
$this->assertInstanceOf( WP_UnitTest_Factory_For_Blog::class, $this->tester->factory()->blog );
}
class FactoryTest extends \Codeception\TestCase\WPTestCase
{
/**
* It should expose the blog factory on the tester property
*
* @test
*/
public function should_expose_the_blog_factory_on_the_tester_property()
{
$this->assertInstanceOf(WP_UnitTest_Factory_For_Blog::class, $this->tester->factory()->blog);
}
}
19 changes: 10 additions & 9 deletions tests/wploadersuite/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ public function should_expose_each_factory_type_on_the_factory_property($factory
$this->assertInstanceOf($factoryClass, $this->tester->factory()->{$factoryType});
}

/**
* It should throw if trying to use blog factory when not in multi-site context
*
* @test
*/
public function should_throw_if_trying_to_use_blog_factory_when_not_in_multi_site_context() {
$this->expectException(ModuleException::class);
/**
* It should throw if trying to use blog factory when not in multi-site context
*
* @test
*/
public function should_throw_if_trying_to_use_blog_factory_when_not_in_multi_site_context()
{
$this->expectException(ModuleException::class);

$this->tester->factory()->blog;
}
$this->tester->factory()->blog;
}
}

0 comments on commit abfeaf3

Please sign in to comment.