Skip to content

Commit

Permalink
Merge pull request #3547 from cakephp/3.0-no-network
Browse files Browse the repository at this point in the history
3.0 Fix failing tests when there is no network
  • Loading branch information
lorenzo committed May 22, 2014
2 parents 1232fd7 + f46582e commit 711f420
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 45 deletions.
11 changes: 7 additions & 4 deletions tests/TestCase/Network/SocketTest.php
@@ -1,7 +1,5 @@
<?php
/**
* SocketTest file
*
* CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
Expand All @@ -17,6 +15,7 @@
namespace Cake\Test\TestCase\Network;

use Cake\Network\Socket;
use Cake\Network\Error\SocketException;
use Cake\TestSuite\TestCase;

/**
Expand Down Expand Up @@ -383,8 +382,12 @@ public function testGetContext() {
'ssl' => array('capture_peer' => true)
)
);
$this->Socket = new Socket($config);
$this->Socket->connect();
try {
$this->Socket = new Socket($config);
$this->Socket->connect();
} catch (SocketException $e) {
$this->markTestSkipped('No network, skipping test.');
}
$result = $this->Socket->context();
$this->assertEquals($config['context'], $result);
}
Expand Down
41 changes: 0 additions & 41 deletions tests/TestCase/TestSuite/TestCaseTest.php
@@ -1,9 +1,5 @@
<?php
/**
* CakeTestCaseTest file
*
* Test Case for CakeTestCase class
*
* CakePHP : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
Expand Down Expand Up @@ -183,8 +179,6 @@ public function testBadAssertTags() {
* @return void
*/
public function testLoadFixturesOnDemand() {
$this->markTestIncomplete('Cannot work until fixtures are fixed');

$test = new FixturizedTestCase('testFixtureLoadOnDemand');
$test->autoFixtures = false;
$manager = $this->getMock('Cake\TestSuite\Fixture\FixtureManager');
Expand All @@ -195,47 +189,12 @@ public function testLoadFixturesOnDemand() {
$this->assertEquals(0, $result->errorCount());
}

/**
* testLoadFixturesOnDemand
*
* @return void
*/
public function testUnoadFixturesAfterFailure() {
$this->markTestIncomplete('Cannot work until fixtures are fixed');
$test = new FixturizedTestCase('testFixtureLoadOnDemand');
$test->autoFixtures = false;
$manager = $this->getMock('Cake\TestSuite\Fixture\FixtureManager');
$manager->fixturize($test);
$test->fixtureManager = $manager;
$manager->expects($this->once())->method('loadSingle');
$result = $test->run();
$this->assertEquals(0, $result->errorCount());
}

/**
* testThrowException
*
* @return void
*/
public function testThrowException() {
$this->markTestIncomplete('Cannot work until fixtures are fixed');
$test = new FixturizedTestCase('testThrowException');
$test->autoFixtures = false;
$manager = $this->getMock('Cake\TestSuite\Fixture\FixtureManager');
$manager->fixturize($test);
$test->fixtureManager = $manager;
$manager->expects($this->once())->method('unload');
$result = $test->run();
$this->assertEquals(1, $result->errorCount());
}

/**
* testSkipIf
*
* @return void
*/
public function testSkipIf() {
$this->markTestIncomplete('Cannot work until fixtures are fixed');
$test = new FixturizedTestCase('testSkipIfTrue');
$result = $test->run();
$this->assertEquals(1, $result->skippedCount());
Expand Down

0 comments on commit 711f420

Please sign in to comment.