Add Segment data factory

[MAILPOET-1546]
This commit is contained in:
Pavel Dohnal
2018-10-02 08:46:49 +02:00
parent b0f5b4cfe9
commit fd72756622
2 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,48 @@
<?php
namespace MailPoet\Test\DataFactories;
use Carbon\Carbon;
class Segment {
private $data;
public function __construct() {
$this->data = [
'name' => 'List ' . uniqid(),
];
}
/**
* @param string $name
* @return $this
*/
public function withName($name) {
$this->data['name'] = $name;
return $this;
}
/**
* @param string $description
* @return $this
*/
public function withDescription($description) {
$this->data['description'] = $description;
return $this;
}
/**
* @return $this
*/
public function withDeleted() {
$this->data['deleted_at'] = Carbon::now();
return $this;
}
/** @return \MailPoet\Models\Segment */
public function create() {
return \MailPoet\Models\Segment::createOrUpdate($this->data);
}
}

View File

@ -76,4 +76,4 @@ class SubscriptionFormMultipleListsCest {
$I->waitForText($subscriber_email);
$I->see('Subscribed', Locator::contains('tr', $subscriber_email));
}
}
}