update slack msg
This commit is contained in:
parent
bc1c6b85bc
commit
b950238865
@ -45,7 +45,7 @@ db_pull_command:
|
||||
# just using `acli pull:db ${ACQUIA_ENVIRONMENT_ID}`
|
||||
echo "Using ACQUIA_ENVIRONMENT_ID=${ACQUIA_ENVIRONMENT_ID}"
|
||||
set -x # You can enable bash debugging output by uncommenting
|
||||
db_dump=$(acli pull:db ${ACQUIA_ENVIRONMENT_ID} --no-interaction --no-import | tail -2l | xargs)
|
||||
db_dump=$(acli pull:db ${ACQUIA_ENVIRONMENT_ID} --no-interaction --no-import | tail -2l | xargs | sed 's/^.* //')
|
||||
ls /var/www/html/.ddev >/dev/null # This just refreshes stale NFS if possible
|
||||
cp ${db_dump} /var/www/html/.ddev/.downloads/db.sql.gz
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
<configured-by-url>true</configured-by-url>
|
||||
<remarks>DDEV generated data source</remarks>
|
||||
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mariadb://127.0.0.1:55000/db?user=db&password=db</jdbc-url>
|
||||
<jdbc-url>jdbc:mariadb://127.0.0.1:60724/db?user=db&password=db</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
|
@ -156,7 +156,10 @@
|
||||
</component>
|
||||
<component name="PhpInterpreters">
|
||||
<interpreters>
|
||||
<interpreter id="64ff8bd0-da32-4db6-9020-b3f9551fc212" name="DDEV" home="docker-compose://DATA" auto="false" debugger_id="php.debugger.XDebug">
|
||||
<interpreter id="433cd30a-1c6c-4a8a-add6-1bc9690ebb8d" name="ddev/ddev-webserver:v1.22.6-CdsConnector-built" home="docker://DATA" auto="false" debugger_id="php.debugger.XDebug">
|
||||
<remote_data INTERPRETER_PATH="php" HELPERS_PATH="/opt/.phpstorm_helpers" VALID="true" RUN_AS_ROOT_VIA_SUDO="false" DOCKER_ACCOUNT_NAME="Docker" DOCKER_IMAGE_NAME="ddev/ddev-webserver:v1.22.6-CdsConnector-built" DOCKER_REMOTE_PROJECT_PATH="/opt/project" />
|
||||
</interpreter>
|
||||
<interpreter id="5014b4e6-3391-4e3d-969b-fe6f41325964" name="CdsConnector" home="docker-compose://DATA" auto="false" debugger_id="php.debugger.XDebug">
|
||||
<remote_data INTERPRETER_PATH="php8.2" HELPERS_PATH="/opt/.phpstorm_helpers" VALID="true" RUN_AS_ROOT_VIA_SUDO="false" DOCKER_ACCOUNT_NAME="Docker" DOCKER_COMPOSE_SERVICE_NAME="web" DOCKER_REMOTE_PROJECT_PATH="/opt/project">
|
||||
<PathMappingSettings>
|
||||
<option name="pathMappings">
|
||||
@ -179,6 +182,86 @@
|
||||
</interpreter>
|
||||
</interpreters>
|
||||
</component>
|
||||
<component name="PhpInterpretersPhpInfoCache">
|
||||
<phpInfoCache>
|
||||
<interpreter name="ddev/ddev-webserver:v1.22.6-CdsConnector-built">
|
||||
<phpinfo binary_type="PHP" php_cli="/usr/bin/php8.1" path_separator=":" version="8.1.26">
|
||||
<additional_php_ini>/etc/php/8.1/cli/conf.d/10-mysqlnd.ini, /etc/php/8.1/cli/conf.d/10-opcache.ini, /etc/php/8.1/cli/conf.d/10-pdo.ini, /etc/php/8.1/cli/conf.d/15-xml.ini, /etc/php/8.1/cli/conf.d/20-apcu.ini, /etc/php/8.1/cli/conf.d/20-bcmath.ini, /etc/php/8.1/cli/conf.d/20-bz2.ini, /etc/php/8.1/cli/conf.d/20-calendar.ini, /etc/php/8.1/cli/conf.d/20-ctype.ini, /etc/php/8.1/cli/conf.d/20-curl.ini, /etc/php/8.1/cli/conf.d/20-dom.ini, /etc/php/8.1/cli/conf.d/20-exif.ini, /etc/php/8.1/cli/conf.d/20-ffi.ini, /etc/php/8.1/cli/conf.d/20-fileinfo.ini, /etc/php/8.1/cli/conf.d/20-ftp.ini, /etc/php/8.1/cli/conf.d/20-gd.ini, /etc/php/8.1/cli/conf.d/20-gettext.ini, /etc/php/8.1/cli/conf.d/20-iconv.ini, /etc/php/8.1/cli/conf.d/20-igbinary.ini, /etc/php/8.1/cli/conf.d/20-imagick.ini, /etc/php/8.1/cli/conf.d/20-intl.ini, /etc/php/8.1/cli/conf.d/20-ldap.ini, /etc/php/8.1/cli/conf.d/20-mbstring.ini, /etc/php/8.1/cli/conf.d/20-msgpack.ini, /etc/php/8.1/cli/conf.d/20-mysqli.ini, /etc/php/8.1/cli/conf.d/20-pdo_mysql.ini, /etc/php/8.1/cli/conf.d/20-pdo_pgsql.ini, /etc/php/8.1/cli/conf.d/20-pdo_sqlite.ini, /etc/php/8.1/cli/conf.d/20-pgsql.ini, /etc/php/8.1/cli/conf.d/20-phar.ini, /etc/php/8.1/cli/conf.d/20-posix.ini, /etc/php/8.1/cli/conf.d/20-readline.ini, /etc/php/8.1/cli/conf.d/20-redis.ini, /etc/php/8.1/cli/conf.d/20-shmop.ini, /etc/php/8.1/cli/conf.d/20-simplexml.ini, /etc/php/8.1/cli/conf.d/20-soap.ini, /etc/php/8.1/cli/conf.d/20-sockets.ini, /etc/php/8.1/cli/conf.d/20-sqlite3.ini, /etc/php/8.1/cli/conf.d/20-sysvmsg.ini, /etc/php/8.1/cli/conf.d/20-sysvsem.ini, /etc/php/8.1/cli/conf.d/20-sysvshm.ini, /etc/php/8.1/cli/conf.d/20-tokenizer.ini, /etc/php/8.1/cli/conf.d/20-uploadprogress.ini, /etc/php/8.1/cli/conf.d/20-xmlreader.ini, /etc/php/8.1/cli/conf.d/20-xmlrpc.ini, /etc/php/8.1/cli/conf.d/20-xmlwriter.ini, /etc/php/8.1/cli/conf.d/20-xsl.ini, /etc/php/8.1/cli/conf.d/20-zip.ini, /etc/php/8.1/cli/conf.d/25-memcached.ini</additional_php_ini>
|
||||
<configuration_file>/etc/php/8.1/cli/php.ini</configuration_file>
|
||||
<configuration_options>
|
||||
<configuration_option name="include_path" value=".:/usr/share/php" />
|
||||
</configuration_options>
|
||||
<debuggers />
|
||||
<loaded_extensions>
|
||||
<extension name="Core" />
|
||||
<extension name="FFI" />
|
||||
<extension name="PDO" />
|
||||
<extension name="Phar" />
|
||||
<extension name="Reflection" />
|
||||
<extension name="SPL" />
|
||||
<extension name="SimpleXML" />
|
||||
<extension name="Zend OPcache" />
|
||||
<extension name="apcu" />
|
||||
<extension name="bcmath" />
|
||||
<extension name="bz2" />
|
||||
<extension name="calendar" />
|
||||
<extension name="ctype" />
|
||||
<extension name="curl" />
|
||||
<extension name="date" />
|
||||
<extension name="dom" />
|
||||
<extension name="exif" />
|
||||
<extension name="fileinfo" />
|
||||
<extension name="filter" />
|
||||
<extension name="ftp" />
|
||||
<extension name="gd" />
|
||||
<extension name="gettext" />
|
||||
<extension name="hash" />
|
||||
<extension name="iconv" />
|
||||
<extension name="igbinary" />
|
||||
<extension name="imagick" />
|
||||
<extension name="intl" />
|
||||
<extension name="json" />
|
||||
<extension name="ldap" />
|
||||
<extension name="libxml" />
|
||||
<extension name="mbstring" />
|
||||
<extension name="memcached" />
|
||||
<extension name="msgpack" />
|
||||
<extension name="mysqli" />
|
||||
<extension name="mysqlnd" />
|
||||
<extension name="openssl" />
|
||||
<extension name="pcntl" />
|
||||
<extension name="pcre" />
|
||||
<extension name="pdo_mysql" />
|
||||
<extension name="pdo_pgsql" />
|
||||
<extension name="pdo_sqlite" />
|
||||
<extension name="pgsql" />
|
||||
<extension name="posix" />
|
||||
<extension name="readline" />
|
||||
<extension name="redis" />
|
||||
<extension name="session" />
|
||||
<extension name="shmop" />
|
||||
<extension name="soap" />
|
||||
<extension name="sockets" />
|
||||
<extension name="sodium" />
|
||||
<extension name="sqlite3" />
|
||||
<extension name="standard" />
|
||||
<extension name="sysvmsg" />
|
||||
<extension name="sysvsem" />
|
||||
<extension name="sysvshm" />
|
||||
<extension name="tokenizer" />
|
||||
<extension name="uploadprogress" />
|
||||
<extension name="xml" />
|
||||
<extension name="xmlreader" />
|
||||
<extension name="xmlrpc" />
|
||||
<extension name="xmlwriter" />
|
||||
<extension name="xsl" />
|
||||
<extension name="zip" />
|
||||
<extension name="zlib" />
|
||||
</loaded_extensions>
|
||||
</phpinfo>
|
||||
</interpreter>
|
||||
</phpInfoCache>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.1" />
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
|
@ -55,7 +55,6 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
||||
return;
|
||||
}
|
||||
|
||||
//if (is_array($order->getData()[0]['positions'] != null)) {
|
||||
foreach ($order->getData()[0]['positions'] as $item) {
|
||||
if ($item['menge'] > 0) {
|
||||
|
||||
@ -70,18 +69,16 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
||||
]);
|
||||
|
||||
$msg = "Bestellung {$order->getOrderId()}: \n";
|
||||
($item['marke'] ?: $msg .= $item['marke'] . '-');
|
||||
$msg .= $item['name'];
|
||||
$msg .= ' ' . $item['sku'];
|
||||
($item['han'] ?: $msg .= '-' . $item['han']);
|
||||
$msg .= ' Menge: ' . $item['menge'] . "\n";
|
||||
|
||||
if ($order->getStatus() == 1) {
|
||||
$slack->from('CDS-Notify')
|
||||
->send($msg);
|
||||
$slack->from('CDS-Notify')->send($msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,10 +87,6 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
||||
*/
|
||||
private function getWarehouseByGtin(string $gtin)
|
||||
{
|
||||
if ($gtin == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$product = $this->productRepository->findOneBy(['gtin' => $gtin]);
|
||||
|
||||
if ($product) {
|
||||
@ -108,5 +101,4 @@ class SlackNotifySubscriber implements EventSubscriberInterface
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -79,16 +79,8 @@ class HiltesImport
|
||||
*/
|
||||
protected function getFiles(bool $delta = false): bool
|
||||
{
|
||||
$finder = Finder::create();
|
||||
$finder
|
||||
->in($this->currentDirPath . '/hiltes/h2c/')
|
||||
->depth(0);
|
||||
|
||||
if ($delta) {
|
||||
$finder->name('/_D/');
|
||||
} else {
|
||||
$finder->notName('/_D/');
|
||||
}
|
||||
$finder = Finder::create()->in($this->currentDirPath . '/hiltes/h2c/')->depth(0);
|
||||
$delta ? $finder->name('/_D/') : $finder->notName('/_D/');
|
||||
|
||||
if ($finder->hasResults()) {
|
||||
foreach ($finder as $file) {
|
||||
|
@ -15,38 +15,33 @@ use Psr\Log\LoggerInterface;
|
||||
class HiltesImportTest extends TestCase
|
||||
{
|
||||
private $productRepository;
|
||||
private $warehouseRepository;
|
||||
private $stockRepository;
|
||||
private $warehouseRepository;
|
||||
private $logger;
|
||||
private $rootPath;
|
||||
private $hiltesImport;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->productRepository = $this->createMock(ProductRepository::class);
|
||||
$this->warehouseRepository = $this->createMock(WarehouseRepository::class);
|
||||
$this->stockRepository = $this->createMock(StockRepository::class);
|
||||
$this->warehouseRepository = $this->createMock(WarehouseRepository::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
$this->rootPath = '/';
|
||||
|
||||
$this->hiltesImport = new HiltesImport(
|
||||
$this->productRepository,
|
||||
$this->warehouseRepository,
|
||||
$this->stockRepository,
|
||||
$this->logger,
|
||||
$this->rootPath
|
||||
'/path/to/root'
|
||||
);
|
||||
}
|
||||
|
||||
public function testStartImportWithNoFiles()
|
||||
public function testStartImportWithNoFiles(): void
|
||||
{
|
||||
$this->expectException(\RuntimeException::class);
|
||||
$this->expectExceptionMessage('No Files to Import');
|
||||
|
||||
$this->hiltesImport->startImport();
|
||||
$this->assertEquals([], $this->hiltesImport->startImport());
|
||||
}
|
||||
|
||||
public function testStartImportWithFiles()
|
||||
public function testStartImportWithFiles(): void
|
||||
{
|
||||
// Mock the getFiles method to return true
|
||||
$hiltesImport = $this->getMockBuilder(HiltesImport::class)
|
||||
@ -55,44 +50,58 @@ class HiltesImportTest extends TestCase
|
||||
$this->warehouseRepository,
|
||||
$this->stockRepository,
|
||||
$this->logger,
|
||||
$this->rootPath
|
||||
'/path/to/root'
|
||||
])
|
||||
->onlyMethods(['getFiles'])
|
||||
->getMock();
|
||||
|
||||
$hiltesImport->method('getFiles')->willReturn(true);
|
||||
|
||||
$this->assertNull($hiltesImport->startImport());
|
||||
$this->assertIsArray($hiltesImport->startImport());
|
||||
}
|
||||
|
||||
public function testGetFilesWithNoResults()
|
||||
public function testSaveDataWithInvalidData(): void
|
||||
{
|
||||
$this->assertFalse($this->hiltesImport->getFiles());
|
||||
$this->assertFalse($this->hiltesImport->saveData([]));
|
||||
}
|
||||
|
||||
public function testSaveDataWithNoWarehouse()
|
||||
public function testSaveDataWithValidData(): void
|
||||
{
|
||||
$this->logger->expects($this->once())
|
||||
->method('error')
|
||||
->with('No Warehouse');
|
||||
$this->productRepository->method('findOneBy')->willReturn(new Product());
|
||||
$this->warehouseRepository->method('findOneBy')->willReturn(new Warehouse());
|
||||
|
||||
$this->assertFalse($this->hiltesImport->saveData(['product1', '100']));
|
||||
$this->assertTrue($this->hiltesImport->saveData(['1234567890123', '100', '', 'Warehouse1']));
|
||||
}
|
||||
|
||||
public function testSaveDataWithValidData()
|
||||
public function testCheckProductWithExistingProduct(): void
|
||||
{
|
||||
$product = new Product();
|
||||
$product->setGtin('1234567890123');
|
||||
$this->productRepository->method('findOneBy')->willReturn($product);
|
||||
|
||||
$this->assertEquals($product->getId(), $this->hiltesImport->checkProduct('1234567890123'));
|
||||
}
|
||||
|
||||
public function testCheckProductWithNewProduct(): void
|
||||
{
|
||||
$this->productRepository->method('findOneBy')->willReturn(null);
|
||||
|
||||
$this->assertNull($this->hiltesImport->checkProduct('1234567890123'));
|
||||
}
|
||||
|
||||
public function testCheckWarehouseNameWithExistingWarehouse(): void
|
||||
{
|
||||
$warehouse = new Warehouse();
|
||||
$warehouse->setName('Warehouse1');
|
||||
|
||||
$product = new Product();
|
||||
$product->setGtin('product1');
|
||||
|
||||
$this->warehouseRepository->method('findOneBy')->willReturn($warehouse);
|
||||
$this->productRepository->method('findOneBy')->willReturn($product);
|
||||
|
||||
$this->stockRepository->expects($this->once())
|
||||
->method('save');
|
||||
$this->assertEquals($warehouse, $this->hiltesImport->checkWarehouseName('Warehouse1'));
|
||||
}
|
||||
|
||||
$this->assertTrue($this->hiltesImport->saveData(['product1', '100', '', 'Warehouse1']));
|
||||
public function testCheckWarehouseNameWithNewWarehouse(): void
|
||||
{
|
||||
$this->warehouseRepository->method('findOneBy')->willReturn(null);
|
||||
|
||||
$this->assertInstanceOf(Warehouse::class, $this->hiltesImport->checkWarehouseName('Warehouse1'));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user