Skip to content

Commit

Permalink
[Filesystem] Created tests for (dont)SeeFileFound
Browse files Browse the repository at this point in the history
  • Loading branch information
Naktibalda committed Dec 29, 2016
1 parent 990bfd2 commit c054f56
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions tests/unit/Codeception/Module/FilesystemTest.php
@@ -0,0 +1,85 @@
<?php

use Codeception\Module\Filesystem;
use Codeception\Util\Stub;

class FilesystemTest extends \PHPUnit_Framework_TestCase
{

/**
* @var \Codeception\Module\Filesystem
*/
protected $module;

public function setUp()
{
$this->module = new Filesystem(make_container());
$this->module->_before(Stub::makeEmpty('\Codeception\Test\Test'));
}


public function tearDown()
{
$this->module->_after(Stub::makeEmpty('\Codeception\Test\Test'));
}

public function testSeeFileFoundPassesWhenFileExists()
{
$this->module->seeFileFound('tests/data/dumps/mysql.sql');
}

public function testSeeFileFoundPassesWhenFileExistsInSubdirectoryOfPath()
{
$this->module->seeFileFound('mysql.sql', 'tests/data/');
}

/**
* @expectedException PHPUnit_Framework_AssertionFailedError
* @expectedExceptionMessage File "does-not-exist" not found at
*/
public function testSeeFileFoundFailsWhenFileDoesNotExist()
{
$this->module->seeFileFound('does-not-exist');
}

/**
* @expectedException PHPUnit_Framework_AssertionFailedError
* @expectedExceptionMessageRegExp /Directory does not exist: .*does-not-exist/
*/
public function testSeeFileFoundFailsWhenPathDoesNotExist()
{
$this->module->seeFileFound('mysql.sql', 'does-not-exist');
}

public function testDontSeeFileFoundPassesWhenFileDoesNotExists()
{
$this->module->dontSeeFileFound('does-not-exist');
}

/**
* @expectedException PHPUnit_Framework_AssertionFailedError
* @expectedExceptionMessage Failed asserting that file "tests/data/dumps/mysql.sql" does not exist.
*/
public function testDontSeeFileFoundFailsWhenFileExists()
{
$this->module->dontSeeFileFound('tests/data/dumps/mysql.sql');
}

/**
* @expectedException PHPUnit_Framework_AssertionFailedError
* @expectedExceptionMessageRegExp /Directory does not exist: .*does-not-exist/
*/
public function testDontSeeFileFoundFailsWhenPathDoesNotExist()
{
$this->module->dontSeeFileFound('mysql.sql', 'does-not-exist');
}

/**
* @expectedException PHPUnit_Framework_AssertionFailedError
* @expectedExceptionMessage Failed asserting that file "tests/data/dumps/mysql.sql" does not exist.
*/
public function testDontSeeFileFoundFailsWhenFileExistsInSubdirectoryOfPath()
{
$this->module->dontSeeFileFound('mysql.sql', 'tests/data/');
}
}

0 comments on commit c054f56

Please sign in to comment.