Skip to content

Commit

Permalink
Revert fixture changes
Browse files Browse the repository at this point in the history
Fixtures are db-sensitive, so it's not pracical to do a full-file
comparison
  • Loading branch information
AD7six committed Nov 25, 2014
1 parent fe47dec commit 2601d5d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 288 deletions.
36 changes: 22 additions & 14 deletions tests/TestCase/Shell/Task/FixtureTaskTest.php
Expand Up @@ -19,7 +19,6 @@
use Cake\ORM\TableRegistry;
use Cake\Shell\Task\FixtureTask;
use Cake\Shell\Task\TemplateTask;
use Cake\TestSuite\StringCompareTrait;
use Cake\TestSuite\TestCase;

/**
Expand All @@ -28,8 +27,6 @@
*/
class FixtureTaskTest extends TestCase {

use StringCompareTrait;

/**
* fixtures
*
Expand All @@ -44,7 +41,6 @@ class FixtureTaskTest extends TestCase {
*/
public function setUp() {
parent::setUp();
$this->_compareBasePath = CORE_TESTS . 'bake_compare' . DS . 'Fixture' . DS;
$io = $this->getMock('Cake\Console\ConsoleIo', [], [], '', false);

$this->Task = $this->getMock('Cake\Shell\Task\FixtureTask',
Expand Down Expand Up @@ -102,7 +98,15 @@ public function testImportRecordsFromDatabaseWithConditionsPoo() {
$this->Task->params = ['schema' => true, 'records' => true];

$result = $this->Task->bake('Articles');
$this->assertSameAsFile(__FUNCTION__ . '.php', $result);

$this->assertContains('namespace App\Test\Fixture;', $result);
$this->assertContains('use Cake\TestSuite\Fixture\TestFixture;', $result);
$this->assertContains('class ArticlesFixture extends TestFixture', $result);
$this->assertContains('public $records', $result);
$this->assertContains('public $import', $result);
$this->assertContains("'title' => 'First Article'", $result, 'Missing import data %s');
$this->assertContains('Second Article', $result, 'Missing import data %s');
$this->assertContains('Third Article', $result, 'Missing import data %s');
}

/**
Expand All @@ -114,7 +118,7 @@ public function testImportOptionsAlternateConnection() {
$this->Task->connection = 'test';
$this->Task->params = ['schema' => true];
$result = $this->Task->bake('Article');
$this->assertSameAsFile(__FUNCTION__ . '.php', $result);
$this->assertContains("'connection' => 'test'", $result);
}

/**
Expand All @@ -129,7 +133,7 @@ public function testImportRecordsNoEscaping() {
$this->Task->connection = 'test';
$this->Task->params = ['schema' => 'true', 'records' => true];
$result = $this->Task->bake('Article');
$this->assertSameAsFile(__FUNCTION__ . '.php', $result);
$this->assertContains("'body' => 'Body \"value\"'", $result, 'Data has bad escaping');
}

/**
Expand Down Expand Up @@ -314,9 +318,7 @@ public function testMainImportSchema() {
$this->logicalNot($this->stringContains('public $fields')),
$this->logicalNot($this->stringContains('public $records'))
));

$result = $this->Task->bake('Article', 'comments');
$this->assertSameAsFile(__FUNCTION__ . '.php', $result);
$this->Task->bake('Article', 'comments');
}

/**
Expand All @@ -328,10 +330,14 @@ public function testRecordGenerationForBinaryAndFloat() {
$this->Task->connection = 'test';

$result = $this->Task->bake('Article', 'datatypes');
$this->assertSameAsFile(__FUNCTION__ . '-datatypes.php', $result);
$this->assertContains("'float_field' => 1", $result);
$this->assertContains("'bool' => 1", $result);
$this->assertContains("_constraints", $result);
$this->assertContains("'primary' => ['type' => 'primary'", $result);
$this->assertContains("'columns' => ['id']", $result);

$result = $this->Task->bake('Article', 'binary_tests');
$this->assertSameAsFile(__FUNCTION__ . '-binary-tests.php', $result);
$this->assertContains("'data' => 'Lorem ipsum dolor sit amet'", $result);
}

/**
Expand All @@ -348,7 +354,8 @@ public function testGenerateFixtureFile() {
->with($filename, $this->stringContains('ArticlesFixture'));

$result = $this->Task->generateFixtureFile('Articles', []);
$this->assertSameAsFile(__FUNCTION__ . '.php', $result);
$this->assertContains('<?php', $result);
$this->assertContains('namespace App\Test\Fixture;', $result);
}

/**
Expand All @@ -366,7 +373,8 @@ public function testGeneratePluginFixtureFile() {
->with($filename, $this->stringContains('class Articles'));

$result = $this->Task->generateFixtureFile('Articles', []);
$this->assertSameAsFile(__FUNCTION__ . '.php', $result);
$this->assertContains('<?php', $result);
$this->assertContains('namespace TestPlugin\Test\Fixture;', $result);
}

}
12 changes: 0 additions & 12 deletions tests/bake_compare/Fixture/testGenerateFixtureFile.php

This file was deleted.

12 changes: 0 additions & 12 deletions tests/bake_compare/Fixture/testGeneratePluginFixtureFile.php

This file was deleted.

This file was deleted.

This file was deleted.

48 changes: 0 additions & 48 deletions tests/bake_compare/Fixture/testImportRecordsNoEscaping.php

This file was deleted.

26 changes: 0 additions & 26 deletions tests/bake_compare/Fixture/testMainImportSchema.php

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 2601d5d

Please sign in to comment.